We don’t allow questions seeking recommendations for boo开发者_C百科ks, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this questionWorking on a SaaS application in PHP/Zend and want to provide users with the ability to search by neighborhood as well radius from zip code. We've been trying to find a decent Neighborhood DB of the US, but so far have only found very expensive sources.
Has anyone found/built a neighborhood db either by zip code or by lat/long?
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).
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.
not sure how good the data is, but Zillow has some creative commons data: http://www.zillow.com/howto/api/neighborhood-boundaries.htm
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/
精彩评论