谷歌地图和API显示不同的结果 [英] google map and api shows different results
问题描述
原产地:英国伦敦骑士桥海德公园角落站
目的地:The Ritz英国伦敦
结果:1.2英里
而且当我使用api时: b
$ b
结果:4.3英里或5.0英里等。
为什么会有这么多差异。我错过了什么。
Google地图和路线服务(或地理编码)之间存在显着差异。 b $ b
Google地图最初是Google地方信息的实施,这就是问题所在。 directions-service使用地址解析来解析地址,而Google Maps使用PlacesService。
使用directionsRenderer绘制路线时,您会看到有不同的起点 - 和结束位置。
但是,当您首次请求PlacesService获取地点坐标并使用这些坐标请求directionsService时,您将得到一个结果附近的谷歌地图的结果(持续时间可能会有所不同,因为默认情况下directionsvices不会返回结果,取决于当前流量)
I am surprised whether i am doing any wrong or not. When i am finding the distance between two locations on google maps say maps.google.co.uk and when i query their API i get different result. Am i missing somethng?
Origin:Hyde Park Corner Station, Knightsbridge, London, United Kingdom Destination:The Ritz London, United Kingdom Result: 1.2 miles
And when i am using api:
Result:4.3 miles or 5.0 miles etc.
Why is there so much of difference . Am i missing something.
There are significant differences between Google Maps and a service like directions(or geocoding)
Google Maps at first is an implementation of Google Places, and that's the issue here. The directions-service uses geocoding to resolve the addresses, while Google Maps uses the PlacesService.
When you draw the route using the directionsRenderer, you will see that there are different start-and end-locations.
But when you first request the PlacesService to get the coordinates of the places, and use these coordinates to request the directionsService, you will get a result near by the result of Google Maps(the duration may differ, because the directionsService by default will not return results depending on the current traffic)
这篇关于谷歌地图和API显示不同的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!