Let's map México and see what happens
$ export DATABASE_NAME='your_geographic_db'
$ export DATABASE_USER='your_db_user'
$ export DATABASE_PASSWORD='your_db_password'
$ export SECRET_KEY='$ecret!'
$ ./manage.py makemigrations
$ ./manage.py migrate
$ unzip world/data/TM_WORLD_BORDERS-0.3.zip
$ ./manage.py shell
>>> from world import load
>>> load.run()
$ ./manage.py createsuperuser
$ ./manage.py runserver
mex_maps is a django-based API which allows users to perform GeoSpatial analysis, and retrieve geographic data.
This is project is going to be a set of geographic APIs for general purpose, it's inspired by the beautiful maps and APIs from diegovalle, particulary from this repo
You need some tools installed in your system in order to run this application:
- PostgreSQL
- PostGIS
- Python 3.5+
- Virtualenv
- GEOS
- GDAL
- pip
There's also a tutorial on installing and running GeoDjango, which is actually the base of this development.
After you install everything, you need to create a virtualenv and install requirements via pip:
$ virtualenv -p python3.5 env
$ source env/bin/activate
$ pip install -r requirements.txt
Then you can edit the environ.rc
file with your data and then load variables:
$ source environ.rc
You need to create a database with postgis support:
$ createdb mex_maps -E UTF-8
$ psql -d mex_maps
# create extension postgis
Create the database
$ cd world
$ ./manage.py makemigrations
$ ./manage.py migrate
And now you can load the example data ziped in the world/data
directory:
$ ./manage.py shell
>>> from world.load import run
>>> run()
You'll see a list of the countries created in your database
And you can now browse the API at http://localhost:8000
$ ./manage.py test