如何获取 Administration_area_level_1、2 等类型的名称
我正在使用 Google Maps API。 我了解如何进行查询和解析返回的 JSON。
我想要做的是获取 Administration_area_level_1 类型的名称。例如,在美国,administrative_area_level_1 是一个州,在加拿大,它是一个省。 (严格来说,它可以是一个省或一个地区,就像在美国有州和地区一样。)
我正在寻找单词“州”或“省”或任何该位置使用的第一个、第二个,和第三行政区。因此,这甚至可能不是 Google 地图 API 问题,而是本地化问题,但我认为它与 Google 地图 API 相关,当然,除非 API 只是实现公认的标准。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,这并不容易实现。基本上,地理编码器返回的内容与 Google 对该几何图形的内部表示相匹配。
administrative_area
之间的映射因国家/地区而异。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.最好的办法是将您在 wiki 页面上找到的数据正式化,该页面是世界各地邮政地址中的名称和术语的集合:
https://en.wikipedia.org/wiki/Table_of_administrative_divisions_by_country
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