【问题标题】:Google Distance Matrix distance differences with Google Map谷歌距离矩阵与谷歌地图的距离差异
【发布时间】:2014-08-12 11:50:16
【问题描述】:

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

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

距离矩阵网址 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

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

【问题讨论】:

  • 抱歉,本站采用新格式
  • @acutesoftware 。感谢编辑

标签: google-maps url


【解决方案1】:

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

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

DistanceMatrix 响应:

<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>
  • Sector 110, Noida, Uttar Pradesh 201304, India (28.5322238, 77.38340210000001)
  • Sector 18, Noida, Uttar Pradesh 201301, India (28.5688024, 77.32239149999998)

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

  • Domino's Pizza, C 2/22, Sector 18, Noida, UP, India (28.570486, 77.32466899999997)

【讨论】:

  • 已修复。非常感谢 :-)。必须创建 API 密钥并使用 Text Search Requests of Places API 在单独调用中传递上述起点和目的地地址时返回我的纬度/经度。在谷歌地图中验证纬度/经度现在给出 8.5 公里。通过传递整个地址“Fortis Medical Clinic, Sector 110, Noida, Uttar Pradesh 201304”获得原产地纬度/经度为 28.5341820,77.3874220,目的地为 28.5704860,77.3246690 通过传递地址“Domino's Pizza, C 2/22, Sector 18, Noida , UP 201301" 在 XML 响应中。
  • 我在请求中直接给出了纬度和经度。以下是请求: 距离矩阵 - maps.googleapis.com/maps/api/distancematrix/… Google 地图 - google.co.in/maps/dir/'12.970392,77.591457'/… 两个结果中的时间各不相同。是否还有其他参数要包括在内?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-04-11
  • 1970-01-01
  • 2017-12-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多