PostGIS is a spatial database extender for the PostgreSQL Open Source Object-Relational database management system. pgRouting extends the PostGIS/PostgreSQL geospatial database to provide geo-spatial routing and other network analysis functionality. We use these alot as the backend for any web or mobile application.
This installation assumes latest Ubuntu LTS as of October 2014 which is Trusty 14.04. Start by Installing Postgres and then come back to this page.
Postgis basic Installation using apt-get:
apt-get update apt-get install postgresql-9.3-postgis-2.1 apt-get install software-properties-common add-apt-repository ppa:georepublic/pgrouting apt-get update apt-get install postgresql-9.3-pgrouting
To configure a basic GIS database named ‘mydatabase’ and enable PostGIS, pgRouting extensions, just:
su - postgres createdb mydatabase psql mydatabase -c "create extension postgis" psql mydatabase -c "create extension pgrouting"
Thats it. You are ready to connect to the database and perform SQL queries or directly with most GIS desktop software including QGIS.
To convert TAB files to Shape files, use ogr2ogr. You will need to install gdal-bin for this:
apt-get install gdal-bin
To convert files from input.tab to output.shp, just:
ogr2ogr -f 'ESRI Shapefile' -skipfailures -nlt LINESTRING output.shp input.tab
Import Shape file into the new database through QGIS using Database Manager in QGIS.
Good links on:
- Nice Cheat sheet on http://www.postgis.us/downloads/postgis21_cheatsheet.pdf
- pgRouting doco on: http://docs.pgrouting.org/2.0/en/doc/index.html
- PostGIS main site on: http://www.postgis.net/
- QGIS Open Source Desktop GIS software on: http://www.qgis.org/en/site/