How do I get the name of the type of administrativ

2019-07-11 14:15发布

I'm using the Google Maps API. I understand how to make queries and parse the JSON that comes back.

What I'd like to be able to do is get name of the administrative_area_level_1's type. For example, in the United States administrative_area_level_1 is a state, in Canada, it is a Province. (Strictly speaking, it can be a Province or a Territory, just like in the USA we have States and Territories.)

I'm looking for the word "State" or "Province" or whatever the location uses for its 1st, 2nd, and 3rd administrative areas. So this might not even be a Google Maps API question, but rather a localization question, but i think it pertains to Google Maps API, unless, of course, the API is just implementing an recognized standard.

Thanks!

2条回答
姐就是有狂的资本
2楼-- · 2019-07-11 14:26

Your best shot is to formalize the data you find on the wiki page, which is the collection of names and terms in postal addresses around the world:

https://en.wikipedia.org/wiki/Table_of_administrative_divisions_by_country

查看更多
小情绪 Triste *
3楼-- · 2019-07-11 14:52

Unfortunately this is not easily accessible. Basically what is returned by the geocoder matches Google's internal representation of that geometry. The mapping between administrative_area differs for each country.

查看更多
登录 后发表回答