How to put all countries / cities / world states in my database?

I have a complex architectural and web problem. I am trying to make a hiking page for every city in the world for http://www.comehike.com

I need to somehow import all the cities in the world and structure them with a state, which, in turn, is structured by country.

I already have a list of countries that I manually added to db, and then added all the cities of California (there are 300+ if you consider small places), and I realized that I will not be able to do this accurate to all cities in the world.

Is there a way to do this in an automatic way? Where do I get reliable data from? Ideally, I would also have lat / lng.

+4
source share
3

GeoNames - , . , .

+4

, . , :

CSV , USGS GNIS Server (US) US NGA GNS Server ( ), . โ€‹โ€‹ .

1: ISO 3166-1 alpha-2.
2: US FIPS 5-2 1- (, /).
3: NGA GNS (DSG).
4: NGA GNS (UFI).
5: ISO 639-1 alpha-2/3 , .
6: script (, , , ..), .
7: .
8: . 9: .

http://www.opengeocode.org/download.php#cities

0

I recently did the same job. I used ansi SQL so that any relational database system can use scripts.

Here you can find the scripts: https://github.com/MehmetKaplan/SQL_for_Country_State_Cities

PS: The original scripts from which I got the data were here .

0
source

All Articles