使用 google geocode api 仅获取特定于国家/地区的结果 [英] Get only country specific result using google geocode api

查看:21
本文介绍了使用 google geocode api 仅获取特定于国家/地区的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 google geocode api 使用新加坡的邮政编码获取经纬度

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&a​​mp;sensor=false

(2) http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&a​​mp;sensor=false

(3) http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&a​​mp;sensor=false&region=sg

但它从印度返回位置

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.

网址应该是 http://maps.googleapis.com/maps/api/geocode/json?address=Singapore%20505468&a​​mp;sensor=false&components=country:SG

但这不是这里的问题,地理编码器结果是错误的,因为结果将国家设置为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 geocode api 仅获取特定于国家/地区的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆