- Install some prereqs (
sudo apt-get install libpq-dev
) - Install postgresql (
sudo apt-get install postgresql postgresql-contrib
) - Install postgis (
sudo apt-get install postgis
) - Create user 'road_data_user' with password 'pass@123' in psql, create database 'road_data_db' with postgis extension in it, grant superuser permission to 'road_data_user'
commands to be executed in order
sudo -i -u postgres
psql
create user road_data_user with password 'pass@123'
create database road_data_db;
\c road_data_db;
create extension postgis;
grant all privileges on database road_data_db to road_data_user;
alter user road_data_user with superuser;
- Install pip3
- Install virtualenv (
pip install virtualenv
) - Create the virtual environment and activate it
- Install requirements using pip (
pip install -r requirements.txt
) - Create super user (
python manage.py createsuperuser
) - Make migrations (
python manage.py makemigrations
) - Migrate (
python manage.py migrate
) - Run all data populating scripts if this is your first time running the code (Below)
- Run server (
python manage.py runserver
)
Populate data using osm file placed in tmp folder
- Run OSM parser (
python manage.py runscript osm-handle
) - Break road data into 10m chunks (
python manage.py runscript add-intermediate-points
) - If you want to limit the road data to a particular region edit the file and run (
python manage.py runscript bounded-10m-points
) - To get pothole data from a predictions_dump.txt dump edit and run (
python manage.py runscript get_last_7_days_pothole_data
) - Now fill in road data in postgis enbaled postgres database (
python manage.py runscript fill-osm-roaddata-in-db
) - Fill in reference points for nearest road API (
python manage.py runscript fill-base-roaddata-for-snaptoroad
) - Fill the raw pothole data in DB (Last 7 days) (
python manage.py runscript fill-pothole-data-in-db
) - Finally snap all these points to nearest road coordinates and fill in the DB (
python manage.py runscript snap-potholes-to-road-segments
)