最近的邮政编码?
我需要找到一个邮政编码中最接近的 5 个邮政编码。 例如,我有 33304,我需要找到最近的号码,例如 33309、33308...
是否有数据库或 Web 服务可以帮助我?
我想我必须建立自己的数据库才能做到这一点?我知道该怎么做,但万一它已经完成了......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
哪个国家?也许您想查看 Geonames:http://www.geonames.org/
特别是:http://www.geonames.org/export/web-services.html#findNearbyPostalCodes
what country? Maybe you want to checkout Geonames: http://www.geonames.org/
Especially: http://www.geonames.org/export/web-services.html#findNearbyPostalCodes
此答案是对最近要求提供美国邮政编码位置的赏金的回应。
美国人口普查局在其 网站。
邮政编码制表区域是一个 CSV,其中包含(如文件格式描述中所述)以及其他字段:
我将交叉引用上述内容以及来自 人口普查局的县业务模式 CSV,用于获取城市、州和县名称。该文件格式被描述为包含(以及其他字段)(描述位于您选择下载的文件中):
This answer is in response to the recent bounty requesting a location of US Zip Codes.
The United States Census Bureau has a list of zip codes (with latitude and longitude) on their web site.
The zip code tabulation areas is a CSV that contains (as described in the description of the file format), among other fields:
I'd cross reference the above, with data from the Census Bureau's county business patterns CSV to get city, state and county names. This file format is described to contain (among other fields) (description is in the file you select to download):
这是一个免费的网络服务,可以满足您的需求:
http://www.zipwise.com/webservices/
Here is a free web service to do exactly what you need:
http://www.zipwise.com/webservices/
我测试了 geonames,但发现它不够好。测试您邮政编码附近的区域,您将找不到所有邮政编码。这些有很好的结果,但还没有找到任何 API
http://www.searchbug.com/tools/zip-radius.aspx
I tested geonames and did not find it good enough. Test areas near your zip code and you will not find all the zipcodew. These have good results but have not found any API yet
http://www.searchbug.com/tools/zip-radius.aspx
对于最近的邮政编码,有两种方法:查找连续(相邻)的邮政编码和/或根据一个邮政编码的中心到另一个邮政编码的中心的距离(基于纬度和经度)查找最近的邮政编码。
要选择连续邮政编码方法,您将需要邮政编码边界数据。 Alignstar 生产了一款我们非常满意的产品(我们转售它),但 ESRI 和其他几家公司也有很好的产品。我的公司 GreatData.com 开发了一个连续的县产品,并且可以开发一个连续的邮政编码产品,但到目前为止,还没有人提出要求。这可以是数据文件或 API。
要根据质心(邮政编码的纬度/经度中心点)查找最近的邮政编码,您将需要一个包含纬度/经度数据的邮政编码数据库(我们提供了一个,或者转到此处获取一些免费资源的链接:// http://uszipcodes.com/free-zip-code-lookup.htm。如果您只是想要一个 API,而不是自己动手,请告诉我们,我们已经开始开发类似的 API,并将基于此进行开发。 通过质心
执行此操作的一个警告是:我们过去已经看到,如果您有一个大(或长)的相邻邮政编码,则该邮政编码的中心可能比另一个小邮政编码更远,因此您的邮政编码可能比另一个小邮政编码更远。 5 个最近的列表可能会错过相邻的 ZIP。
For the nearest ZIP Code, there are two approaches: find contiguous (adjoining) ZIP Codes and/or find the nearest ZIPs based on the distance from the center of one ZIP Code to the center of another, based on latitude and longitude.
To choose the contiguous ZIP approach, you will need ZIP Code Boundaries data. Alignstar makes one that we're very pleased with (we resell it), but ESRI and a couple of other companies have good products as well. My company, GreatData.com, developed a contiguous counties product and could develop a contiguous ZIP Codes product, but so far, nobody has been asking for it. This could be a data file or an API.
To find the nearest ZIP Codes based on centroids (latitude / longitude center points of the ZIP Code), you will need a ZIP Code Database with latitude / longitude data (we provide one, or go here for links to some free resources: //http://uszipcodes.com/free-zip-code-lookup.htm. If you just want an API and not the hassle of doing it yourself, let us know. We've started to develop similar APIs and will develop based on the demand.
One caveat of doing this by the centroids: we've seen in the past where if you have a large (or long), adjoining ZIP, the center of that ZIP could be farther away than another small ZIP Code, so your list of the 5 nearest could miss an adjoining ZIP.
PostgreSQL 在 9.1 中有一个名为“KNN”的新功能。它专门用于“最近邻居”距离搜索,并且从我自己的基准测试和测试来看,它非常快,并且可以用于邮政编码。这是KNN 快速介绍。
您还可以找到一个
有关将 KNN 应用于邮政编码的线程,以及 最近的后续行动。
PostgreSQL has new feature in 9.1 called "KNN". It is specifically for "Nearest Neighbor" distance searches, and from benchmarking and testing it it myself, it is very fast, and can be used for zipcodes. Here is a quick introduction to KNN.
You can also find a
thread about applying KNN to zipcodes, and a more recent follow-up.