We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
刚刚找到了一种从 2 个数据源创建我自己的邻里数据库的方法。其中一个是带有纬度/经度质心的美国邮政编码的完整文件。另一个是来自 USGS 的免费文件,位于 http://geonames.usgs.gov/domestic/download_data.htm
好消息是,USGS 文件有一个名为“Populated Places”的要素类型,其中在城市地区包含社区名称。我针对 Urbanmapping 进行了测试,对于旧金山和亚特兰大,除了 1 个社区名称之外,它还包含所有社区名称(通过 Neighborhood API 演示)。
由于邮政编码文件和 USGS 文件都有纬度/经度,因此唯一要做的就是将社区名称与邮政编码关联起来。为此,您可以使用以下公式并计算所有邮政编码纬度/经度与所有人口密集地点纬度/经度之间的距离,然后根据要包含的距离进行选择。我使用 5 英里半径作为拉链质心。等式如下:
((ACOS(SIN('.$latitude.' * PI() / 180) * SIN(latitude * PI() / 180) + COS('.$latitude.' * PI() / 180) * COS(纬度 * PI() / 180) * COS(('.$经度.' – 经度) * PI() / 180))* 180 / PI()) * 60 * 1.1515) AS 距离
希望这可以帮助其他人解决同样的问题,并且很难证明许可这些数据的成本是合理的(这对于初创公司来说是巨大的)。
Just found a way to create my own Neighborhood database from 2 data sources. One is a complete file of US Zip codes with Lat/Long Centroids. The other is a free file from the USGS found at http://geonames.usgs.gov/domestic/download_data.htm
The good news is that the USGS file has a Feature Type called "Populated Places", which in urban areas contain neighborhood names. I tested against Urbanmapping and for San Francisco and Atlanta it had all but 1 of their neighborhood names (via Neighborhood API demo).
Since both the zip code file and the USGS file have lat/longs, the only thing left to do is to associate the neighborhood names with the zip codes. To do this you can use the following equation and compute the distance between all zip code lat/long and all Populated Place lat/long, then do a select based on the distance you want to include. I am using a 5 mile radius for the zip centroid. Here's the equation:
((ACOS(SIN(‘.$latitude.’ * PI() / 180) * SIN(latitude * PI() / 180) + COS(‘.$latitude.’ * PI() / 180) * COS(latitude * PI() / 180) * COS((‘.$longitude.’ – longitude) * PI() / 180))* 180 / PI()) * 60 * 1.1515) AS distance
Hope this helps other people struggling with the same issue and having a hard time justifying the cost of licensing this data (which is huge for a start up).
我认为这涵盖了您的问题: https://stackoverflow.com/questions/6095392/resolve -city-code-from-user-input/6354044#6354044
或者,这可能提供值:根据用户输入解析城市。特别是@Michael Borgwardt 的回答。
I think this covers your question: https://stackoverflow.com/questions/6095392/resolve-city-code-from-user-input/6354044#6354044
Alternatively this might offer value: resolve city from user input. In particular @Michael Borgwardt's answer.
不确定数据有多好,但 Zillow 有一些知识共享数据: http:// /www.zillow.com/howto/api/neighborhood-boundaries.htm
not sure how good the data is, but Zillow has some creative commons data: http://www.zillow.com/howto/api/neighborhood-boundaries.htm
我构建了这个工具,至少可以在邮政编码的半径范围内实现这一点:
http://www.woodstitch.com/resources/zip-code-catcher.php
如果您需要知道如何实用地获取某个区域内的邮政编码,它会变得有点棘手,但仍然非常可行 - 我写博客解释如何在这里执行此操作: http://taylor.woodstitch.com/php/php-mysql-best-solutions-for-finding-points-in-a-polygon-from-a-database/
I built this tool that would do the trick at least for the radius of the zip code:
http://www.woodstitch.com/resources/zip-code-catcher.php
If you need to know how to do get zip codes within an area pragmatically it get a bit more tricky but still very doable - I wrote blog explaining how to do it here: http://taylor.woodstitch.com/php/php-mysql-best-solutions-for-finding-points-in-a-polygon-from-a-database/