sjlu / cities

Lookup cities based on zipcodes or GPS coordinates
https://www.npmjs.com/package/cities
27 stars 15 forks source link

how to add another cities? #9

Open sinoohe opened 8 years ago

sinoohe commented 8 years ago

Hi, I want to add other cities(cities of Iran) to this library, How can I do that? where can I find cities boundaries?

sjlu commented 8 years ago

For the US, I've used a government resource which has this all this data. There is a update script in this repository that mines for that information and creates the necessary file to do so. I'd suggest finding a resource similar in nature and starting there.

sjlu commented 8 years ago

After finding a resource & creating a script that does so, we can talk about modifying this repo to selectively choose which country of cities to load in.

sinoohe commented 8 years ago

thanks, From what I see you haven't used city boundaries? what happens when user enters a location within a city?

sjlu commented 8 years ago

Here's a good potential data source: http://www.geonames.org/export/

sjlu commented 8 years ago

So given a latitude and longitude, this will give you the closest approximation to a point and not a polygon. We can also extend this to polygons but I have not found a good enough source that provides this type of data.

sinoohe commented 8 years ago

some projects uses boundaries like : https://github.com/vkurchatkin/which-country/blob/master/lib/data.geo.json

sjlu commented 8 years ago

This is a country boundary, not a city boundary. If you can find a city boundary data source, I'll be happy to implement a polygon search algorithm.

On Tue, Mar 1, 2016 at 10:52 AM, Mehran khajavi notifications@github.com wrote:

some projects uses boundaries like : https://github.com/vkurchatkin/which-country/blob/master/lib/data.geo.json

— Reply to this email directly or view it on GitHub https://github.com/sjlu/cities/issues/9#issuecomment-190780263.

sinoohe commented 8 years ago

I have found this : https://osm.wno-edv-service.de/boundaries/ you can select what ever you want (just for states and countries) and export them as polygons :)