Skip to content

sinaj/casap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-ASAP

C-ASAP project aims to develop a software platform for coordinating the activities around reporting missing persons, notifying volunteers in the vicinity, and coordinating the activities of volunteers who may encounter these missing persons, the family members and the police.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Virtualenv/Virtualenvwrapper
  • Python 3.5.1
  • PostgreSQL and postgis
  • settings_server.py from Carlo Oliva or Yuxuan Zhao

Installing

  1. Clone this repository
  2. cd into the casap directory and add the settings_server.py file here
  3. Create a Virtual Environment using python3
  4. Follow the instructions to install the required geospatial libraries, and postgis

  • Linux example for step 4. OSX users follow similar steps.
  • Credit to Falon Scheers for Linux instructions.
$ sudo apt-get install binutils libproj-dev gdal-bin
  • GEOS download and configure:
$ wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2      
$ tar xjf geos-3.4.2.tar.bz2  
$ cd geos-3.4.2   
$ ./configure     
$ make            
$ sudo make install     
$ cd .. 
  • PROJ.4 is a library for converting geospatial data to different coordinate reference systems:
wget http://download.osgeo.org/proj/proj-4.9.1.tar.gz     
$ wget http://download.osgeo.org/proj/proj-datumgrid-1.5.tar.gz   
Next, untar the source code archive, and extract the datum shifting files in the nad subdirectory. This must be done prior to configuration:    
$ tar xzf proj-4.9.1.tar.gz   
$ cd proj-4.9.1/nad     
$ tar xzf ../../proj-datumgrid-1.5.tar.gz 
$ cd ..     
Finally, configure, make and install PROJ.4:    
$ ./configure     
$ make      
$ sudo make install     
$ cd ..
  • GDAL open source geospatial library that has support for reading most vector and raster spatial data formats:
$ wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz   
$ tar xzf gdal-1.11.2.tar.gz  
$ cd gdal-1.11.2  
Configure, make and install:  
$ ./configure --with-python     
$ make # Go get some coffee, this takes a while.      
$ sudo make install     
$ cd ..
$ sudo lsb_release -a
Add Keys:                  
$ wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -   
$ sudo apt-get update   

Install postgresql 9.5, PostGIS 2.2, PGAdmin3, pgRouting 2.1 :      
$ sudo apt-get install postgresql-9.5-postgis-2.2 pgadmin3 postgresql-contrib-9.5 

To Install pgRouting 2.1 package:         
$ sudo apt-get install postgresql-9.5-pgrouting         

* after PostGIS is installed create database and then put this db name in your settings.py file:             
$ createdb  < db name >          
$ psql < db name >        
$ > CREATE EXTENSION postgis; 

  1. Modify settings_server.py for your own computer and database
DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': '<db name>',
    }
}
  1. Install requirements.txt
$ pip install -r requirements.txt
  1. Make database migrations and migrate to the database
$ python manage.py makemigrations casap
$ python manage.py migrate casap
  • If you get database errors run this: python manage.py migrate --run-syncdb
  1. Load Open Street Maps location data for Alberta
  • Courtesy from Falon Scheers
  • Ask for the /OSMdataProcess folder
  • First read comments in and run file '/OSMdataProcess/getMapModelInfo.py'
  • Then inspect the output file, '/OSMdataProcess/OSMmapModelInfo.txt' and note the desired layer numbers for buildings and POI
  • Then read comments, mend, and run the file 'Load.py' to store OSM locations into your local database

Run the Server

$ python manage.py runserver

Production server

The project is deployed on the RAC server: C-ASAP Server

Production server pre-requisites

In order to make any changes to the production server, ask@olivaCfor a .pem file for access to the server.

Making changes to the production website

  1. Ssh in the server:
ssh ubuntu@162.246.156.196
  1. Activate the virtual environment:
source django-env/bin/activate
  1. cd into the casap project
cd casap
  1. pull changes into either the master/development branch (whichever is being used)
git pull origin development
  1. Enter your github credentials
  2. If any static files were changed, you will need to serve these.
./manage.py collectstatic

Built With

Authors

Acknowledgements

  • Falon Scheers - Location and Activity functionality using OpenLayers and OpenStreetMap