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

ⅰ亾dé卋堺 提交于 2019-12-11 05:36:56

问题


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


回答1:


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/



来源:https://stackoverflow.com/questions/6328896/how-to-calculate-distance-between-two-points-in-driving-direction-mode-in-androi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!