问题描述
我使用google geocode api来获取新加坡的邮政编码 。
我尝试了以下来获取数据:
(1)
(2)
(3)
以其他任何方式只获取特定国家/地区(新加坡)的结果。
我试过以下它会返回正确结果
但这不是问题,地理编码结果是错误的,因为结果将国家设置为 SG
,但位置错误(置于印度)。
我担心给定的地址(看起来邮编不存在),唯一可以做的就是向谷歌报告错误的结果。
I am using google geocode api for fetching lat long using postal code of singapore
I have tried following to fetch data:
(1) http://maps.googleapis.com/maps/api/geocode/json?address=505468&sensor=false
(2) http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&sensor=false
(3) http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&sensor=false®ion=sg
But it returns location from India
https://developers.google.com/maps/documentation/geocoding/?hl=fr#RegionCodes
Any other way to get only country specific (Singapore) result.
I have tried following it returns correct result
http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20133224&sensor=false
To restrict results to a specific country use the component-filtering.
The url should be http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&sensor=false&components=country:SG
But that's not the issue here, the geocoder-result is wrong, because the result has the country set to SG
, but the location is wrong(placed in india).
I'm afraid with the given address(it appears that the postcode doesn't exists), the only thing you can do is to report the wrong result to google.
这篇关于使用Google地理编码api获取特定国家/地区的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!