Google地理编码API-仅在一个国家/地区搜索 [英] Google geocoding API - search in just one country

查看:179
本文介绍了Google地理编码API-仅在一个国家/地区搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google geocode-API寻找地理编码:

I am looking for geocodes with the google geocode-API:

http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK&sensor=false

问题是,输入的信息不太准确(特别是街道),有时google混淆了某些内容,而忽略了英国,因为这条街道在其他地方具有完美的匹配项(例如街道和城市).例如美国.

The problem is, that the input isn't very accurate (specially the street) and sometimes google mixes things up and ignores UK, because the street has a perfect match (as street and city) somewhere else. e.g. US.

现在我无法解决此问题(输入数据),但是我想知道是否存在一个参数,该参数会迫使google在英国搜索并且不返回任何结果,而不会返回完全错误的结果.

Now i cannot solve this issue (input data), but I am wondering if there is a parameter, which forces google to search in UK and return no result instead of a completly wrong result.

推荐答案

您可以在url中添加组件过滤器以约束结果.在这种情况下,您可以使用:

You can add component filters in the url to constraint results. In this case you can use:

http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK**&components=country:UK**&sensor=false

有关如何使用组件过滤的更多信息,请参见:

For more information about how to use component filtering see:

https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering

这篇关于Google地理编码API-仅在一个国家/地区搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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