Wednesday, February 4, 2009

Postgresql Spatial Database (GIS) using PostGIS

Postgresql is a open source database that has an add-on module named PostGIS.
PostGis adds support for geographic objects. It allows you to spatial enable your databases.
With the onset of websites like Google maps, having the ability to map locations, map routes, etc, is becoming common place.
With PostGis, I am able to quickly and easily determine distances between 2 locations. I can retrieve longitude and latitude values.

Installing PostGIS

I am using Fedora 8, so I needed to install PostGis from source.

Install from Source Method
1) download, configure, make proj (version 4.6.1)
notes: yum installs files to /usr/share/pgsql/contrib/lwpostgis.sql, postgis_comments.sql, spatial_ref_sys.sql,
from source files get installed to /usr/share/lwpostgis.sql, lwpostgis_upgrade.sql, spatial_ref_sys.sql

2) After compiling proj from source,
a) edit /etc/ld.so.conf
add /usr/local/lib
b) ldconfig
c) recompile PostGis ( if previously installed)

3) Compiling PostGis from source,
a) just run ./configure (without options)
b) then: make
c) make install
4) createlang plpgsql [yourdatabase]
5) psql -d [yourdatabase] -f lwpostgis.sql
6) psql -d [yourdatabase] -f spatial_ref_sys.sql
PostGis is found at http://postgis.refractions.net

1 comment:

  1. Hey Dave,
    How is everything going?

    I think it is great that you are blogging about the technical aspects of your website.



    Your Pal

    Joe O'Brien

    ReplyDelete