amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Distance between address #646

Closed marcosgerene closed 5 years ago

marcosgerene commented 5 years ago

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

marcosgerene commented 5 years ago

@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

amay077 commented 5 years ago

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.

marcosgerene commented 5 years ago

@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 ...

linda-dge commented 5 years ago

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 < notifications@github.com> 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 commented 5 years ago

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 < notifications@github.com> 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 .

marcosgerene commented 5 years ago

@linda-dge

Driving distance is a different story.

Yeah! So I question about this library...

Thanks

marcosgerene commented 5 years ago

@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

amay077 commented 5 years ago

Thanks @linda-dge , @marcosgerene

Xamarin.Essentials.Location.CalculateDistance is the answer!

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

marcosgerene commented 5 years ago

@amay077 @linda-dge Thanks!!