2

My app currently uses Location Services. During debugging, I retrieve my current location using GetLastKnownLocationAsync: myposition.Latitude is 40.758896 while myposition.Latitude is -73.985130.

My SQL Database has a list of Walmart stores, and there's a Walmart with Latitude & Longitude of 40.660992 & -73.7267629.

How can I calculate the driving distance between my set of coordinates and Walmart's coordinates? It would be something like Google Maps' Driving Directions or Waze.

I understand that I can use this SO link to calculate the distance between two sets of point, but I assume apps like Google Maps or Waze consider the actual driving distance between two sets of points. The link above would be great if there were a straight street between two points. Obviously, that's not the case.

fdkgfosfskjdlsjdlkfsf
  • 3,165
  • 2
  • 43
  • 110
  • 4
    you need to find a GPS service that will provide this data for you. Like https://developers.google.com/maps/documentation/directions/start – Jason Mar 05 '19 at 01:10
  • Example service would be https://www.microsoft.com/en-us/maps/distance-matrix – Depechie Mar 07 '19 at 13:47

1 Answers1

0

I have used Xamarin.Essential library to find the distance between two point

You can use something like this

  var location = new Location(21.705723, 72.998199);
  var otherLocation = new Location(22.3142, 73.1752);
  double distance =  location.CalculateDistance(otherLocation,DistanceUnits.Kilometers);
Pragnesh Mistry
  • 386
  • 5
  • 13
  • will this return the driving distance? I mean to say will it give distance of by roads or by water (if points in sea or river) ? – Sagar Panwala May 14 '19 at 04:53