Google Geocoding returning totally different result from Google Map

社会主义新天地 提交于 2019-11-28 09:12:08

问题


For the location of

Charles La Trobe P-12 College,Victoria,Australia

Google maps produce the exact location of said college.

However, when requested via GEOCODE API, either http://maps.googleapis.com/maps/api/geocode/json?address=Charles+La+Trobe+P-12+College,Victoria,Australia&sensor=false

or on their demo page https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple

the address above gets a result thats far, far from the exact location.

any ideas?


回答1:


The entry on Google Maps is a "place" not a geocoded result.

Charles La Trobe P-12 College
235 Kingsbury Dr, Macleod Victoria 3085, Australia ‎
+61 3 9223 1400 ‎ · vic.edu.au 

The Places API finds the correct location (as the first result). The geocoder returns a result for Victoria, Australia (-37.4713077, 144.7851531), which is the best "address" it can find in the string you gave it.

http://www.geocodezip.com/v3_example_geo2.asp?addr1=Charles%20La%20Trobe%20P-12%20College,Victoria,Australia&addr2=Charles%20La%20Trobe%20P-12%20College,Victoria,Australia&place=1&geocode=2




回答2:


After reading through lot of answers i came across this solution that Gecoder is used to find the nearest postal addresses.To get Local Business Data use Google Places API

https://developers.google.com/places/web-service/search#PlaceSearchRequests

it can be done like this

https://maps.googleapis.com/maps/api/place/textsearch/json?query=someplacename&key=key


来源:https://stackoverflow.com/questions/18436153/google-geocoding-returning-totally-different-result-from-google-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!