Xamarin.forms.googlemaps: Distance between address

Created on 21 Aug 2019  ·  9Comments  ·  Source: amay077/Xamarin.Forms.GoogleMaps

Hi,

I just need calculate the distance between my location and an address.
I just need time and distance.
I don't need navigation, maps, multiple routes or anything.

How can I do this?

Thanks

enhancement

Most helpful comment

Driving distance is a different story.

You use Google's api.

https://developers.google.com/maps/documentation/distance-matrix/intro

Linda Rawson

On Fri, Aug 23, 2019 at 7:46 AM Linda Rawson linda@dynagrace.com wrote:

Once you have the lat/lon there is a method in Xamarin Essentials Location

Xamarin.Essentials.Location.CalculateDistance(new
Xamarin.Essentials.Location(coord1.Latitude, coord1.Longitude), new
Xamarin.Essentials.Location(coord2.Latitude, coord2.Longitude),
Xamarin.Essentials.DistanceUnits.Kilometers);

or old faithful calculations like Haverstine or Great Circle

Linda Rawson

On Fri, Aug 23, 2019 at 5:24 AM Marcos Gerene F. Spirito <
[email protected]> wrote:

@amay077 https://github.com/amay077

If I convert the address to lat / lon and call this method, will the
result be the distance traveled by a car or straight?

I need the distance traveled by a car ...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/amay077/Xamarin.Forms.GoogleMaps/issues/646?email_source=notifications&email_token=AMCTXTHD2QKKRNREFEP7ZZLQF7CGXA5CNFSM4IN6FZVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4754VY#issuecomment-524279383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCTXTEISXKU6WUHWHQW4ZDQF7CGXANCNFSM4IN6FZVA
.

All 9 comments

@amay077

My issue has recieve "enhancement" label, so the library no answer this, right?

Do you have a forecast for implementation?

Should I wait for this or is it better to look another solution?

Thanks

Yes I will add Position.ToDistance(Position) method.
This method like Android's Location.distanceTo method .

But this method does NOT provide Address to Lat/Lon conversion.

@amay077

If I convert the address to lat / lon and call this method, will the result be the distance traveled by a car or straight?

I need the distance traveled by a car ...

Once you have the lat/lon there is a method in Xamarin Essentials Location

Xamarin.Essentials.Location.CalculateDistance(new
Xamarin.Essentials.Location(coord1.Latitude, coord1.Longitude), new
Xamarin.Essentials.Location(coord2.Latitude, coord2.Longitude),
Xamarin.Essentials.DistanceUnits.Kilometers);

or old faithful calculations like Haverstine or Great Circle

Linda Rawson

On Fri, Aug 23, 2019 at 5:24 AM Marcos Gerene F. Spirito <
[email protected]> wrote:

@amay077 https://github.com/amay077

If I convert the address to lat / lon and call this method, will the
result be the distance traveled by a car or straight?

I need the distance traveled by a car ...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/amay077/Xamarin.Forms.GoogleMaps/issues/646?email_source=notifications&email_token=AMCTXTHD2QKKRNREFEP7ZZLQF7CGXA5CNFSM4IN6FZVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4754VY#issuecomment-524279383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCTXTEISXKU6WUHWHQW4ZDQF7CGXANCNFSM4IN6FZVA
.

Driving distance is a different story.

You use Google's api.

https://developers.google.com/maps/documentation/distance-matrix/intro

Linda Rawson

On Fri, Aug 23, 2019 at 7:46 AM Linda Rawson linda@dynagrace.com wrote:

Once you have the lat/lon there is a method in Xamarin Essentials Location

Xamarin.Essentials.Location.CalculateDistance(new
Xamarin.Essentials.Location(coord1.Latitude, coord1.Longitude), new
Xamarin.Essentials.Location(coord2.Latitude, coord2.Longitude),
Xamarin.Essentials.DistanceUnits.Kilometers);

or old faithful calculations like Haverstine or Great Circle

Linda Rawson

On Fri, Aug 23, 2019 at 5:24 AM Marcos Gerene F. Spirito <
[email protected]> wrote:

@amay077 https://github.com/amay077

If I convert the address to lat / lon and call this method, will the
result be the distance traveled by a car or straight?

I need the distance traveled by a car ...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/amay077/Xamarin.Forms.GoogleMaps/issues/646?email_source=notifications&email_token=AMCTXTHD2QKKRNREFEP7ZZLQF7CGXA5CNFSM4IN6FZVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4754VY#issuecomment-524279383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCTXTEISXKU6WUHWHQW4ZDQF7CGXANCNFSM4IN6FZVA
.

@linda-dge

Driving distance is a different story.

Yeah! So I question about this library...

Thanks

@linda-dge @amay077

The google API has a cost, my client just needs a forecast to know how to order travels by closest to farthest.

This solve my issue:

Xamarin.Essentials.Location.CalculateDistance(new
Xamarin.Essentials.Location(coord1.Latitude, coord1.Longitude), new
Xamarin.Essentials.Location(coord2.Latitude, coord2.Longitude),
Xamarin.Essentials.DistanceUnits.Kilometers);

Thanks

Thanks @linda-dge , @marcosgerene

Xamarin.Essentials.Location.CalculateDistance is the answer!

I don't add Position.ToDistance(Position) method in Xamarin.Forms.GoogleMaps.

@amay077 @linda-dge
Thanks!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dreamsystems picture dreamsystems  ·  5Comments

PeterRT picture PeterRT  ·  7Comments

prajithmp picture prajithmp  ·  6Comments

Gavrielo picture Gavrielo  ·  3Comments

JKennedy24 picture JKennedy24  ·  6Comments