androidgoogle-mapsmappingdriving-directions

How To Calculate Distance Between Two Points in Driving Direction Mode in Android


everyone... I have something to ask about using a MapView in Android with Google Maps API..

I've read about how to make a Geopoint or more and find a distance between 2 points..

One thing that still makes me confuse is about calculating a distance between 2 points. I've tried and find the result but it's applied if the condition is when I want to make a straight line between those points. But, when I crosscheck with maps.google.com, the result (distance) is different with the same latitude and longitude of those points. And I realize that its a kind of a Driving Direction..

example of Google Map Web

If you see the picture, it's not a straight line so of course the distance is different. So how could I calculate this distance in Android in this case? And please show me the code to make it...


Solution

  • Yes it will return you the straight line distance between two point.. you can use Google direction API for this ...Here is the link for this. http://code.google.com/apis/maps/documentation/directions/