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

前端 未结 1 1897
你的背包
你的背包 2020-12-12 06:31

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 pl

1条回答
  •  伪装坚强ぢ
    2020-12-12 07:23

    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)

    0 讨论(0)
提交回复
热议问题