0
votes

I'm currently in a fight with the Google Maps API.

For example, San José in Costa Rica. There is a city called 'San José' and a province 'San José'. I need to find the province. So I use this request:

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

You would think this should return the province San José, but it doesn't. It returns the city.

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

When I search for: http://maps.googleapis.com/maps/api/geocode/xml?address=San Jose Province&components=country:CR&language=nl (only difference is an e instead of an é in Jose) it does return the province.

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

But of course this is being used grammatically and the input is "san josé". How can I get only results of provinces? (administrative_area 's)

1

1 Answers

0
votes

You also get the administrative_area_level_1 result if you query for "Province of San José":

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

This may work differently across different countries think. I'd venture this form (Province of ...) is more common ─and likely to get the right results─ in Spanish speaking countries.