开发者

How to get the "distance by road" in google maps api?

开发者 https://www.devze.com 2023-03-21 06:30 出处:网络
If you try get the distance of: Presidente Vargas 817, Centro RJ rua de santana macaé rj in Maps v3 API computeDistanceBetween(), you got *155*566.80511451405...but..

If you try get the distance of:

  1. Presidente Vargas 817, Centro RJ
  2. rua de santana macaé rj

in Maps v3 API computeDistanceBetween(), you got *155*566.80511451405...but..

in maps.google: you got: 187 km !!!

UPDATE: Maps.google returns the distanc开发者_运维问答e by road, have a way to get this distance?


The computeDistanceBetween() function is giving you a result in meters, as the crow flies. The maps.google.com example is giving a result in kilometers, as the car drives. Thus the route is slightly longer.

The actual driving distance between two points will almost never match the shortest possible distance between them.

0

精彩评论

暂无评论...
验证码 换一张
取 消