database 基于邮政编码的纬度和经度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11354490/
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
Latitude and Longitude based on Zip Code
提问by arsenal
My requirement is to get the Latitude and Longitude value for a particular zip code. Is there any API that I can use to get these information. As I am working in a company so the requirement is coming for our team is to find the latitude and longitude value for a particular zip code. So we were thinking to build a new service for this. So what reliable data source we can use to get these information back if we are passing zip code to our service. Or what can be the best approach that I can propose to my PM about this requirement. Any pointers will be appreciated.
我的要求是获取特定邮政编码的纬度和经度值。是否有任何 API 可用于获取这些信息。由于我在一家公司工作,因此我们团队的要求是找到特定邮政编码的纬度和经度值。所以我们想为此建立一个新的服务。那么,如果我们将邮政编码传递给我们的服务,我们可以使用哪些可靠的数据源来获取这些信息。或者我可以向我的 PM 提出关于此要求的最佳方法是什么。任何指针将不胜感激。
Just to add, that data source should have all the zip codes, latitudes and longitude in a world. Not that much accurate but mostly it should cover around more than 95% coverage.
补充一点,该数据源应该包含世界上所有的邮政编码、纬度和经度。不是那么准确,但大多数情况下它应该覆盖超过 95% 的覆盖率。
Update
更新
I did some research and I found that I can use Maxmind data for this but Maxmind data doesn't cover all the zip code list.
我做了一些研究,发现我可以为此使用 Maxmind 数据,但 Maxmind 数据并未涵盖所有邮政编码列表。
采纳答案by Viccari
Please have a look at Google Geocoding APIand at Yahoo! PlaceFinder.
请查看Google Geocoding API和Yahoo! 地点查找器。
Both of them have Geocoding features, which is exactly what you want (obtaining map (latitude, longitude) coordinates from partial or full addresses).
它们都具有地理编码功能,这正是您想要的(从部分或完整地址获取地图(纬度、经度)坐标)。
回答by 03Usr
You can download zip code and corresponding lat and long values for different countries from here: (this is open source data and free of charge)
您可以从这里下载不同国家的邮政编码和相应的经纬度值:(这是开源数据,免费)
http://download.geonames.org/export/dump/
http://download.geonames.org/export/dump/
You can then import the data into your database and query it.
然后,您可以将数据导入数据库并进行查询。
Hope this helps.
希望这可以帮助。
回答by puddleglum
If you need commercial grade, consider this: http://greatdata.com. If you do not need this level of quality, hereis a list of some other sources w/ pros & cons (it's worth reading just to understand the differences between zip, zcta, usps, census, etc. versions of the data).
如果您需要商业级,请考虑:http: //greatdata.com。如果您不需要这种质量水平,这里是一些其他来源的列表,其中包含优缺点(值得一读以了解 zip、zcta、usps、人口普查等数据版本之间的差异)。
ps - you said 'entire world' but your other responses and the term 'zip code' itself seem to imply primarily US. The above link goes beyond US but not the entire world.
ps - 您说的是“整个世界”,但您的其他回复和“邮政编码”一词本身似乎主要是指美国。上述链接超越了美国,但不是整个世界。
Regarding the Google API mentioned already, please be aware of Google's TOS. Specifically: "Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited."
关于已经提到的 Google API,请注意Google 的 TOS。特别是:“注意:地理编码 API 只能与谷歌地图结合使用;禁止地理编码结果不显示在地图上。”
I am an employee for greatdata.
我是 Greatdata 的员工。
回答by waterproof
GeoNames has a nice straightforward API with pretty good coverage. (Docs)
GeoNames 有一个很好的简单的 API,覆盖范围很好。(文档)
example usage: http://api.geonames.org/postalCodeSearch?postalcode=98122&maxRows=10&username=demo
用法示例:http: //api.geonames.org/postalCodeSearch?postalcode=98122&maxRows=10&username=demo
回答by Geektracker
I have a situation where there are 12 warehouses nationwide and I needed to find the nearest one that has inventory for an item. My simple solution was to take the absolute value of the difference between the target zip code and the 12 warehouses. And then, simply ordering them by the lowest to highest difference in zip code numbers and querying the inventory in that order. It seems that just getting the ABS(zip1 - zip2), yields the closet distance between two zipcodes.
我的情况是全国有 12 个仓库,我需要找到最近的一个有库存的仓库。我的简单解决方案是取目标邮政编码和12个仓库之间差异的绝对值。然后,只需按照邮政编码从最低到最高的差异对它们进行排序,然后按该顺序查询库存。似乎只是获得 ABS(zip1 - zip2),就会产生两个邮政编码之间的最近距离。
回答by LavaSlider
What about this: http://www.boutell.com/zipcodes/?
这个怎么样:http: //www.boutell.com/zipcodes/?

