0
votes

I am trying to enable new functionality in application. I need a full list with countries->regions/states/provinces->cities/villages and i need a database that have all needed data. Another functionality is find all this data by country + postal(zip) code.

After couple day of research, I found geonames api. I downloaded data, but city table have 2,5 millions cities. So this is too big data for local database and searching is too slow. After this I started use geonames, but this time within API.

I have a test cities:

  • US, Maryland, Phoenix - 21131

  • US, Utah, Provo - 84604 Ukraine

  • Cherkassy, Cherkassy - 18001.

I tried all methods and each time some city data was wrong or not existing. I tried to find city by country+postal code, country+placename, by lat+lng, by east+west+north+south and each time some data was wrong. What I need to have Is region/state/province name, city name and unique id.
I am trying to finish this task last 2 weeks so I'll be fired, if will not finish this task soon) Maybe someone know good free API or working query for geonames? Sorry for my English and thanx for any help.

1
Please edit to add meaningful code and a problem description here. Posting a minimal reproducible example that demonstrates your problem would help you get better answers. Thanks! - Purgatory
There are too many ways to approach this problem. The answers would just turn into a straw-poll for which one people liked. The best thing is to do some research on the topic yourself, find two or three, analyze them, determine if they work for you or not, and try them out. Come to us when you have a specific question about something you have attempted to do. - Machavity
Remember that postal codes pertain to multiple cities and even states so you might want to not use postal codes. - Jeffrey

1 Answers

0
votes

The UN maintains such a list you can download as a csv, access database or text file here http://www.unece.org/cefact/locode/welcome.html from there you can develop a small form in ajax (or with reloads) starting by country and refining. If you have issues with the php behind this, i can help you along the way, but from what i understand, you are looking for true, clean, valid data. this is where you get it