PostGIS 2.0svn Build & Install for Raster Support on Virtual Machine install of Fedora 16

Just a quick overview of how to build & install the great raster features of PostGIS 2.0 svn. I am aiming at using this data type in my current work of dem interpolation & raster derivatives based on Victorial Island in Canada’s Arctic.

As always please let me know what you think.

Build targets Fedora 16 & Postgresql 9.1 on a 32 bit machine. I am running this as a virtual machine using Virtualbox. I am using a virtual machine for the features it offers of cloning & snap shoting.

Assumptions:

  • localhost connection desired for database work
  • fresh install Fedora 16 with no spatial packages installed

We will be using YUM to supply all spatial components. This might not be ideal for the latest packages but will serve to build a functional postgis 2.0 with Raster support.

  1. Open terminal & su root
  2. install spatial components
    1. QGIS will install many of the spatial dependencies & will be used to review rasters from postgis2.0
      1. yum install qgis.i686 qgis-python.i686 qgis-devel.i686
      2. yum install proj-devel.i686 geos-devel.i686 gdal-devel.i686 libxml2.i686 libxml2-devel.i686 dblatex.noarch ImageMagick.i686 ImageMagick-devel.i686
  3. install postgresql database
    1. yum install postgresql.i686 postgresql-server.i686 postgresql-libs.i686 postgresql-contrib.i686 postgresql-devel.i686 pgadmin3
  4. setup database
    1. postgresql-setup initdb
  5. start postgresql
    1. service postgresql start
  6. enable service to start when machine starts
    1. systemctl enable postgresql.service
  7. su postgres -c psql
    1. ALTER USER postgres WITH PASSWORD ‘your password for postgres‘;
    2. \q
  8. edit pg_hba.conf file for localhost connections
    1. leafpad /var/lib/pgsql/data/pg_hba.conf
      1. change “method” column values to “md5” & save
    2. service postgresql restart
  9. open pgAdmin 3
    1. File – Add Server
      1. name = test
      2. host = localhost
      3. username = postgres
      4. password = what was set in step 7.1
    2. Right click Login Roles – New Login Role ( create another user to connect to database)
      1. Properties Tab: role name = enter a name
      2. Definition Tab: password = enter password
      3. Role Privileges Tab: click Superuser
  10. create database to install postgis onto. (-U = user to connect to database. Use name from step 9.2)
    1. createdb -U richard test_postgis
  11. cd into directory to download PostGIS2.0svn in & extract
    1. wget http://postgis.refractions.net/download/postgis-2.0.0SVN.tar.gz
    2. tar -zxvf downloaded file from above
    3. cd into extracted directory
    4. ./configure –with-raster
      1. check for warnings with ./configure –with-raster | grep -i warnings
      2. install any dependencies that are required. Often the development packages are required.
    5. Make
      1. ensure this is output at end “PostGIS was built successfully. Ready to install.”
    6. make install
  12. enable postgis onto created database from step 10
    1. psql -d test_postgis -U richard -f /usr/share/pgsql/contrib/postgis-2.0/postgis.sql
    2. psql -d test_postgis -U richard -f /usr/share/pgsql/contrib/postgis-2.0/spatial_ref_sys.sql
    3. psql -d test_postgis -U richard -f /usr/share/pgsql/contrib/postgis-2.0/rtpostgis.sql

 

The spatial database has been created with the PostGIS 2.0svn Raster support. Please refer to the following documentation on the functions present for the raster type:

 

In a follow up article I will be talking about loading raster data into the postgis database using the GDAL toolkit.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s