Sunday, October 10, 2010

PostGreSQL 8.4 and PostGIS 1.4 on Ubunutu 10

I was planning on installing PostGIS 8.4/1.4 on the latest Ubuntu (10) so I could get a little smarter at what is considered by many as the best Open Source GIS DB solution available. 

I spent some time on the Google machine discovering how to do this and the only tutorials I came across were recreations of the documentation. I was hoping there would be some comment trail regarding the issues I was having. The installation stuff works just fine but when you attempt to run the GIS SQL on the template DB, things become fun.

The problems really boil down to paths. I was following what I thought was a current-ish (2008) walk-through but hit a roadblock when following the SQL file loading steps. This prepares a template GIS DB for all future GIS DB creation.  After fixing the usual version problems with the path I found that there were no SQL files where the post suggested they should be. The local docs only specified the file by itself, without any path information. The reference was close, but close only matters in horseshoes and hand-grenades.

The 2-year old reference I was following:

The local docs are installed here:
file:///usr/share/doc/postgis/postgis/postgis.html

After doing some searching, the SQL files actually end up here:
/usr/share/postgresql/8.4/contrib

Once you have the path correct, the GIS template DB can be created and you will have access to the various functions provided by PostGIS. The goal here is to see the following output after executing:
psql -d postgis -c "select postgis_full_version();"

postgis_full_version
------------------------------------------------------------------
POSTGIS="1.4.0" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.7.1, 23 September 2009" USE_STATS
(1 row)

The next big difference occurs when I attempted to install QGIS. I received the typical message that the package manager saw QGIS but had it referred to by another package. So I headed over to the QGIS web site at qgis.org and found the correct package sources. I added these to my package manager and QGIS installed perfectly.

No comments:

Post a Comment