Tuesday, May 20, 2014

Install pgRouting extension with postgresql 9.3

Installing cutting edge software is always fun.  So my journey was to install pgrouting 2.0.0.2 with postgresql 9.3 and postgis 2.1.2 on  a Ubuntu 12.04 machine for some testing.

As it looks this was not so strait forward I had to use some debian packages which are thankfully easy to install.  Visit each of theses sites then scroll WAY down to the bottom, select your system architecture then click the link to download

https://packages.debian.org/sid/postgresql-9.3-pgrouting

plus: (update 20.08.2014 now using libboost-thread1.55.0 and libboost-system1.55.0)
    https://packages.debian.org/sid/libcgal10
    https://packages.debian.org/sid/libboost-thread1.55.0
    https://packages.debian.org/sid/libboost-system1.55.0/

Now how to install pgrouting begins with viewing each page and scrolling down on each page then select a server to download then simply download and you should have the following .deb install files in your downloads folder. (if you are using AMD64 architecture)

  1. libboost-system1.55.0_1.55.0+dfsg-2_amd64.deb
  2. libboost-thread1.55.0_1.55.0+dfsg-2_amd64.deb
  3. libcgal10_4.4-1+b1_amd64.deb
  4. postgresql-9.3-pgrouting_2.0.0-2+b1_amd64.deb

Now finally to the installation part, simply double click each .deb in your Nautilus explorer then the package installer should automatically open.  Important install each in the same order as I have listed above to meet the dependencies of the pgrouting .deb installer.

Now you can open up your pgAdmin and be able to use the super easy install extension.  Or for you command line guys / gals out there you can login to
sudo -u postgres psql
CREATE EXTENSION pgrouting;
\q
Well I hope that helps you out.   If you need any help you can find me at http://gomogi.com/about/contact

cheereo
Michael

Monday, May 12, 2014

ogr2ogr upload shapefile to postgis

Simple quick upload a shapefile to an existing postgis database into an existing schema called "geodata"

upload shapefile to postgis with ogr2ogr:
# upload shapefile into postgis schema and automatically create the table named "test C:\OSGeo4W\bin\ogr2ogr.exe -lco GEOMETRY_NAME=geom -append -lco SCHEMA=geodata -f "PostgreSQL" PG:"host=domainName port=5432 user=username dbname=dbName password=secretpasswrd" -a_srs "EPSG:3785" C:/somepath/myshapefile.shp -nln NewTableName )