iOS 从邮政编码查找位置(纬度、经度)
获取给定邮政编码的位置的最佳方法是什么?它适用于美国/加拿大以外的国家吗?谢谢
What could be the best way to get location for a given zipcode. Would it work for countries outside US/Canada .Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Google 地理定位 API(在 google.com/maps 上尝试一下):
输入瑞士邮政编码,例如:
CH-9014
或法国的:
FR-34000
或德语:
de-12101
或美国:
us-90210
或加拿大:
ca-J5Z 1A1
或中国:
示例的cn-100000
:
因此,
瑞士邮政编码 9014 对应于 appx。到此位置:
请在此处查看我对地理定位 API 的回答:
如何获取 GLatLng 对象预先在谷歌地图中输入地址字符串?
Use the Google geolocating API (try it out on google.com/maps):
Input for a Swiss ZIP code for example:
CH-9014
or a french one:
FR-34000
or german:
de-12101
or US:
us-90210
or canada:
ca-J5Z 1A1
or china:
cn-100000
for example:
yields
So the swiss ZIP code 9014 corresponds appx. to this location:
See my answer on the geolocating API here:
How to get GLatLng object from address string in advance in google maps?
GeoNames 提供多种邮政编码地理编码服务,包括搜索给定邮政编码的位置。他们支持许多不同的国家。
您可能对邮政编码服务的地名查找最感兴趣
GeoNames offers a number of various zipcode geocoding services, including search for the location of a given zipcode. They support a number of various countries.
You would probably be most interested in the Placename Lookup for postalcode service
Google 的 API 带有一些相当讨厌的限制。根据 @Claus Broch 的建议,最好使用 GeoNames 等开源资源。
我添加这个答案也是为了注意到 MapQuest 最近为 OpenStreetMap 数据提供了一个 API。它不进行(据我所知)邮政编码搜索,但位置名称、方向、海拔等都可以自由查询。我最近发现了它,我计划尽快用它替换我对谷歌地图 API 的调用。
http://developer.mapquest.com/web/products/open
Google's API comes with some fairly nasty restrictions. Better to use open sources like GeoNames per @Claus Broch's suggestion.
I'm adding this answer to also note that MapQuest has recently put up an API to OpenStreetMap data. It doesn't do (as far as I can tell) zip code searching, but location names, directions, altitude etc are all freely queryable. I recently discovered it an I plan on replacing my calls to google maps API with it as soon as I can.
http://developer.mapquest.com/web/products/open