google-maps - 谷歌距离矩阵与谷歌地图的距离差异

标签 google-maps url

我正在尝试使用 Google 距离矩阵 url 获取以下起点和目的地之间的距离,但我得到的距离为 9.2 km 。以下是参数和 URL

origins=Fortis Medical Clinic, Sector 110, Noida, Uttar Pradesh 201304
destinations=Domino's Pizza, C 2/22, Sector 18, Noida, UP 201301
mode=driving 

距离矩阵 URL http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Fortis%20Medical%20Clinic,%20Sector%20110,%20Noida,%20Uttar%20Pradesh%20201304&destinations=Domino%27s%20Pizza,%20C%202/22,%20Sector%2018,%20Noida,%20UP%20201301&mode=driving

如果我使用谷歌地图获取同一地址的距离,我得到的距离为 8.5 公里。以下是网址 https://www.google.co.in/maps/dir/Fortis+Medical+Clinic,+Sector+110,+Noida,+Uttar+Pradesh+201304/Domino%27s+Pizza,+C+2%2F22,+Sector+18,+Noida,+UP+201301/@28.5472397,77.3183475,13z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x390ce8a50f230aad:0x62e94434495d1e29!2m2!1d77.387422!2d28.534182!1m5!1m1!1s0x390ce44932c98b67:0x54ee608ae1801238!2m2!1d77.324669!2d28.570486

不确定为什么同一地址的距离存在差异。特定路由是否会发生这种情况?如果是,为什么?或任何其他原因。任何帮助表示赞赏。谢谢。

最佳答案

“Domino's Pizza”和“Fortis Medical Clinic”是 "Places"不是地址(查看距离矩阵的响应以了解它如何解释这些字符串)。要查找 Google map 报告的相同距离,请使用 Places API找到它们的位置(坐标),然后在 DistanceMatrix 调用中使用这些位置。

类似问题:How to solve the Difference between Google Maps and Geocoding?

距离矩阵响应:

<DistanceMatrixResponse>
  <status>OK</status>
    <origin_address>Sector 110, Noida, Uttar Pradesh 201304, India</origin_address>
    <destination_address>Sector 18, Noida, Uttar Pradesh 201301, India</destination_address>
  • 印度北方邦诺伊达 110 区, zip 201304 (28.5322238, 77.38340210000001)
  • 印度北方邦诺伊达 18 区, zip 201301 (28.5688024, 77.32239149999998)

Places API 没有列出“Fortis Medical Clinic”(或者至少有一个不同的位置),但列出了“Domino's Pizza”(这给了我 8.5 公里的距离):

  • Domino's Pizza,C 2/22,Sector 18,诺伊达,UP,印度 (28.570486, 77.32466899999997)

关于google-maps - 谷歌距离矩阵与谷歌地图的距离差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24348982/

相关文章:

javascript - 当平移带有大量标记和折线的 map 时,如何限制谷歌地图 API 滞后?

android - 在 Flutter 应用程序的源代码管理中 stash Google Maps API key

Django:识别提供重复内容的网址并设置规范链接

python - 正则表达式 - 如何使行尾可选

c# - 如何在 C# 中解析 HTTP url?

javascript - 如何通过连接 Google map 中的外部点来创建多边形

android - Google Play 服务 + Android Studio 模拟器

java - 在jsp中插入非编码的html代码

javascript - 如何在angularjs的函数中进入下一个摘要循环

javascript - URL 被 chop 为 255 个字符