Java 按邮政编码查找位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9766115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Find location by zip code
提问by AurA
I am looking for a google API or any other API that returns me location ( in the form of latitude/longitude or place name )
我正在寻找一个谷歌 API 或任何其他返回我位置的 API(以纬度/经度或地名的形式)
Using Geocoder I can find lat,long as long as I know the name of place.
使用地理编码器我可以找到纬度,只要我知道地名。
It can we a web service or some query to some online database. I don't want to populate the US Zip codes to a local database.
它可以是我们的网络服务或对某个在线数据库的一些查询。我不想将美国邮政编码填充到本地数据库。
采纳答案by Andrew Leach
Google's webservice and the Javascript geocoder both geocode zipcodes on their own without an explicit placename. There is a rate limit and a daily limit with both. Google's Terms of Service don't permit permanent storage of geocoded data — which you don't intend to do — but they do mandate displaying the geocoded point(s) on a Google map (which you may not be intending to do).
Google 的网络服务和 Javascript 地理编码器都自行对邮政编码进行地理编码,而没有明确的地名。两者都有速率限制和每日限制。Google 的服务条款不允许永久存储地理编码数据(您不打算这样做),但它们确实要求在 Google 地图上显示地理编码点(您可能不打算这样做)。
Five-digit zipcodes default to the USPS codes, I believe. For other countries' five-digit codes you need to specify the country.
我相信,五位数的邮政编码默认为 USPS 代码。对于其他国家/地区的五位数代码,您需要指定国家/地区。
Edit:
编辑:
Documentation for Javascript API: https://developers.google.com/maps/documentation/javascript/geocoding
Example for Javascript API: https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple(try entering 90210)
Documentation for webservice: https://developers.google.com/maps/documentation/geocoding/
Example request: http://maps.googleapis.com/maps/api/geocode/xml?address=90210&sensor=false
Javascript API 文档:https: //developers.google.com/maps/documentation/javascript/geocoding
Javascript API 示例:https: //google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple(尝试输入90210)网络服务
文档:https: //developers.google.com/maps/documentation/geocoding/
示例请求:http: //maps.googleapis.com/maps/api/geocode/xml ?address = 90210 &sensor =错误的
You may find that certain countries' postal codes don't work. But to make the blanket statement they are not providing location search based on zipcodeis not correct. If you are having difficulty with a particular country's postal codes — like India's PIN code perhaps — it's best to be specific.
您可能会发现某些国家/地区的邮政编码不起作用。但是为了做出全面的声明,他们不提供基于邮政编码的位置搜索是不正确的。如果您对特定国家/地区的邮政编码(例如印度的 PIN 码)有困难,最好具体说明。
Edit #2:
编辑#2:
If you are interested in Indian pincodes then a top-ranking Google result was this thread: https://groups.google.com/group/datameet/browse_thread/thread/db5b8a3f4033ae36
如果您对印度密码感兴趣,那么排名靠前的谷歌结果是这个线程:https://groups.google.com/group/datameet/browse_thread/thread/db5b8a3f4033ae36
回答by Andreas Dolk
回答by Hades
If you're in the UK then the only way to effectively do this using Google Maps API is to write it in javascript due to the limitation Google place on the number of API calls per day from a single IP address.
如果您在英国,那么使用 Google Maps API 有效执行此操作的唯一方法是用 javascript 编写它,因为 Google 限制了每天从单个 IP 地址调用 API 的数量。
If yous solution is going to be under moderate usage load then you may want to look at a solution that utilises the UK Royal Mail PAF file. One such service that I've integrated with for my work is Postcode Anywhere (www.postcodeanywhere.com). They have a great API available in various formats... it was the easiest integration I've done lately.
如果您的解决方案将处于中等使用负载下,那么您可能需要查看使用英国皇家邮政 PAF 文件的解决方案。我为我的工作集成的一项这样的服务是 Postcode Anywhere (www.postcodeanywhere.com)。他们有各种格式的很棒的 API……这是我最近完成的最简单的集成。
回答by Brent Worden
GeoNamesprovides several geolocation related web servicesincluding lat/long information for zip codes.