Google Maps API: get two locations distance and plot on map

做~自己de王妃 提交于 2020-01-09 12:04:32

问题


I am new at Google Maps. I want to the get distance from one place to another place and plot it on a map.

e.g: Place1 and Place2 Distance - xxx Km (xx miles) and plot it on map.

Please take a look.


回答1:


Use the geometry library computeDistanceBetween() function. If you don't have the coordinates, use the Geocoder to get them.

Example (based off of the example in the documentation)



来源:https://stackoverflow.com/questions/13542052/google-maps-api-get-two-locations-distance-and-plot-on-map

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