Skip to content

Python script to save GeoSpaces country, states and cities to mongodb

License

Notifications You must be signed in to change notification settings

russosanti/geomongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

world-cities-mongodb

Do you want a database which contains most of cities in the world as well as the countries? This app will save 3 collections to your mongodb:

  1. cities
  2. states
  3. countries

Why use it

  • Language agnostic because it's not a lib. Consume the result database using any language you like.
  • Source data from GeoNames.org is under active updates. And this app will let you update in few seconds.
  • python main.py to generate the database from source data
  • python update.py to update the source data from GeoNames
  • Remove any fields you don't need in settings.py
  • Could filter countries which only speak certain languages. (see setting.py)

Python version

  • Python 3
  • Python 2 should be fine, but haven't tried.

How to use

  1. git clone

  2. pip install uses requirements.txt

  3. Open settings.py, set up your database settings.

  4. python main.py

  5. Enjoy :)

  • To update the source data in data folder: python update.py

Folder Structure

  • [data]: [Folder] Raw data from GeoNames
  • [models]: [Folder] database fields for city and country
  • [utils]: [Folder] Helper function
  • settings.py: Settings
  • main.py: Main file to generate the database
  • update.py: Update the source data from GeoNames

About the data

  • The data is from GeoNames.

  • The cities contains cities which population greater than 500.

  • How to update the data

    • python update.py

About

Python script to save GeoSpaces country, states and cities to mongodb

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages