APi project for working with geospatial data. Interacts with a database table of places with id, name, description and coordinates fields.
API demonstration video: link.
- documentation at /api/doc/swagger/
- getting a list of places
- creating a place
- retrieving a place by its ID
- updating (and partial updating) a place
- deleting a place
- getting a place that is the nearest to provided coordinates as a query parameter
Technologies used:
- Django REST Framework
- PostgreSQL and PostGIS
Docker should be installed.
- Clone project
git clone https://github.com/yuliia-stopkyna/geo-app.git
cd geo-app
-
Create
.env
file with your environment variables (look at.env.sample
example file) in the project directory. -
Run docker
docker-compose build
docker-compose up
Install PostgreSQL with PostGIS extension and create database.
- Clone project and create virtual environment
git clone https://github.com/yuliia-stopkyna/geo-app.git
cd geo-app
python -m venv venv
source venv/bin/activate # on MacOS
venv\Scripts\activate # on Windows
pip install -r requirements.txt
- Install Geospatial libraries (GDALL, GEOS, PROJ): more information about it here.
- On Debian/Ubuntu
sudo apt-get install binutils libproj-dev gdal-bin
-
macOS instruction is here.
-
If you run on Windows, you can use OSGeo4W installer for geospatial libraries. Make sure to pick GDAL package. Then, in the
geo_app/settings.py
uncommentGDAL_LIBRARY_PATH
,GEOS_LIBRARY_PATH
,PROJ_LIB
and specify the path to the corresponding files on your computer (must be inOSGeo4W
directory).
- Set environment variables
set POSTGRES_HOST=<your db host>
set POSTGRES_DB=<your db name>
set POSTGRES_USER=<your db user>
set POSTGRES_PASSWORD=<your db password>
set DJANGO_SECRET_KEY=<your Django secret key>
- Make migrations and run server
python manage.py migrate
python manage.py runserver