Google Maps Api仅查找省

时间:2017-02-22 14:08:53

标签: google-maps geocoding google-geocoding-api

我目前正在使用Google Maps API。

例如,哥斯达黎加的圣何塞。 有一个叫做“圣何塞”的城市和一个省份“圣何塞”。我需要找省。所以我使用了这个请求:

http://maps.googleapis.com/maps/api/geocode/xml?address=San José Province&components=country:CR&language=nl

你会认为这应该归还圣何塞省,但事实并非如此。它返回了城市。

<type>locality</type>
<type>political</type>

当我搜索: http://maps.googleapis.com/maps/api/geocode/xml?address=San Jose Province&components=country:CR&language=nl (唯一不同的是 e 而不是Jose中的é) 它确实会回归该省。

<type>administrative_area_level_1</type>
<type>political</type>

但当然这是在语法上使用,输入是“sanjosé”。 我怎样才能获得各省的结果? (administrative_area的)

1 个答案:

答案 0 :(得分:0)

如果您查询“圣何塞省”,您也会获得administrative_area_level_1结果:

http://maps.googleapis.com/maps/api/geocode/json?address=Province%20of%20San%20Jos%C3%A9&components=country:CR

这可能会因不同国家的不同而有所不同。在西班牙语国家,我冒险这种形式(省...)更常见 - 并且很可能得到正确的结果。

相关问题