Skip to content

WKT Raster is now PostGIS Raster

October 1, 2010

The WKT PostGIS raster code is now part of PostGIS trunk. Quick install instructions (from PostGIS sources):

  1. ./configure –with-raster
  2. make
  3. make rt-all
  4. make install
  5. make rt-install
  6. createdb <your_database>
  7. createlang plpgsql <your_database>
  8. psql -f postgis/postgis.sql -d <your_database>
  9. psql -f spatial_ref_sys.sql -d <your_database>
  10. psql -f raster/rt_pg/rtpostgis.sql -d <your_database>

UPDATE 1 (2010-10-22): With the last release (r6095) it’s an easier process:

  1. ./configure –with-raster
  2. make
  3. make install
  4. createdb <your_database>
  5. createlang plpgsql <your_database>
  6. psql -U <your_user> -f postgis/postgis.sql -d <your_database>
  7. psql -U <your user> -f spatial_ref_sys.sql -d <your_database>
  8. psql -U <your user> -f raster/rt_pg/rtpostgis.sql -d <your_database>

In case your user requires a password, add -W as psql flag, and you’ll be prompted for the password. Further information in README.postgis and README.raster files.

And of course, I’m working on GDAL PostGIS Raster driver. I’ll add the new specifications ASAP.

UPDATE 2 (2010-10-21): New version of the driver committed to repository.  Now its name is postgisraster, instead the old one: wktraster. Further information in the link above.

22 Comments leave one →
  1. November 9, 2010 1:54 pm

    Thanks for enhancing my knowledge. Geomarketing was not aware about these changes but now you made me informative. Thanks a lot dear…

  2. December 2, 2010 11:37 am

    I am trying to install POSTGIS raster. When i do make, it builds successfully saying:
    “PostGIS was built successfully. Ready to install.” But after this when i try try to check the installation using: make raster-check i get the following error:
    make -C raster check
    make[1]: Entering directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster’
    make -C test check
    make[2]: Entering directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster/test’
    make -C core check
    make[3]: Entering directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster/test/core’
    cc -g -O2 -fPIC -DPIC -Wall -Wmissing-prototypes -I../../rt_core -I/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/liblwgeom -I/usr/include/gdal -o testapi testapi.c -lm ../../rt_core/librtcore.a /home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/liblwgeom/liblwgeom.a -L/usr/lib -lgdal1.7.0
    testapi.c: In function ‘main’:
    testapi.c:1061: error: ‘LWPOLY’ has no member named ‘SRID’
    testapi.c:1061: error: ‘LWPOLY’ has no member named ‘SRID’
    make[3]: *** [testapi] Error 1
    make[3]: Leaving directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster/test/core’
    make[2]: *** [check] Error 2
    make[2]: Leaving directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster/test’
    make[1]: *** [check] Error 2
    make[1]: Leaving directory `/home/niket/Downloads/wktraster-0.1.6d/postgis/trunk/raster’
    make: *** [raster-check] Error 2
    niket@niket-laptop:~/Downloads/wktraster-0.1.6d/postgis/trunk$ make rt-all
    make: *** No rule to make target `rt-all’. Stop.
    niket@niket-laptop:~/Downloads/wktraster-0.1.6d/postgis/trunk$ make rt-all
    make: *** No rule to make target `rt-all’. Stop.

    Could you help me with this error.

    • December 2, 2010 4:42 pm

      Hi Niket,

      That error was caused because the field “SRID” of the structure “LWPOLY” changed its name to “srid” in a commit 4 days ago. I didn’t realize on that, but I fixed it. Please, update to the most recent version on SVN, and many thanks for your report.

      BTW, remember now you only need to execute:

      ./configure –with-raster
      make install

      • December 3, 2010 5:58 am

        Thanks Jorgearevalo,

        It was really helpful, I could install postgisraster successfully now.

  3. December 6, 2010 8:52 am

    Hi Jorgearevalo,

    I am not sure this is the right place for this problem.
    With present version of postgisraster is it possible to derive a raster layer from vector layer? If yes, how? because there is no documentation on the same.

    Any help is appreciated.

    Thanks in advance.

  4. sibusiso permalink
    May 24, 2011 3:51 pm

    I’m new with lunix and I’m struggling to install postgis wkt raster on my lunix.if any one has step to install the raster please post for me thanks.

  5. sibusiso permalink
    May 25, 2011 3:02 pm

    hi again

    i’ve follow the step,i’ve created the Postgis145 database which work fine,but when im trying to execute the bellow commands:
    psql -d Postgis145 -f postgis.sql
    psql -d Postgis145 -f postgis_comments.sql
    psql -d Postgis145 -f spatial_ref_sys.sql
    psql -d Postgis145 -f rtpostgis.sql
    psql -d Postgis145 -f raster_comments.sql
    psql -d Postgis145 -f topology/topology.sql
    psql -d Postgis145-f doc/topology_comments.sql

    it give me error message ” no such file or directory” please advice thanks.

    • May 25, 2011 3:12 pm

      The psql “-f” option needs the path to the sql file you’re trying to load. Please pay attention to the fact that my original lines were like:

      psql -U -f postgis/postgis.sql -d

      psql -U -f spatial_ref_sys.sql -d

      psql -U -f raster/rt_pg/rtpostgis.sql -d

      For example, if you unzipped the postgis sources in /usr/src/postgis-2.0, then, the 3 files above are:


      These are the 3 SQL files needed. The rest are optional.

  6. Raj permalink
    November 16, 2011 11:58 pm

    Dear Jorge,

    As far as i know in st_makeemptyraster () function skewx and skewy are roation parameter. Suppose I want to make a empty raster in south-west direction i.e. rotate 225 degree from the North. In this case if I insert value other than zero in place of skewx and skewy why the formed raster will not rotate? can you help me please regarding this?

  7. Jack permalink
    March 13, 2012 9:33 am

    I am looking for information regarding an error I am receiving when I try to load rtpostgis.sql. The Error indicates that the library could not be loaded because of an undefined symbol: GDALFPolygonize. I verified the symbol exists in the .so library, so I don’ see why postgreSQL is having difficulty loading it. has anyone seen this behavior before?

    • March 13, 2012 10:55 am

      Hi Jack,

      Which version of PostGIS/GDAL are you using?

      • Jack permalink
        April 18, 2012 10:46 pm


      • April 19, 2012 10:37 am

        And GDAL? You need 1.9.x

      • Jack permalink
        April 19, 2012 11:06 pm

        gdal-1.9.0, geos-3.3.2, proj-4.8.0

        I built and installed postgresql-9.1.3 (–with-python), proj-4.8.0 (–without-jni), geos-3.3.2 (–enable-python), and gdal-1.9.0 (–with-python –with-java=/opt/jdk1.6.0_26 –with-geos=../geos-3.3.2/tools/geos-config).

        Finally, I built PostGIS-2.0.1SVN –with-raster –with-pgconfig=/usr/local/pgsql/bin/pg_config –with-geosconfig=../geos-3.3.2/tools/geos-config.

  8. May 2, 2012 1:57 pm

    Hi, Sorry for the delay. Could you please attach the error log?

    • Jack permalink
      May 2, 2012 10:20 pm

      Thanks to the postgis-users group I was able to get a solution to this. The problem I was having was a different version of GDAL had been installed and my LD_LIBRARY_PATH was pointing to it without my knowledge. So, if you happen to see an issue with GDALFPolygonize, it is likely a gdal library version problem. Check environment very carefully for all instances of the gdal library. Thanks for the help Jorge.


  1. How to install and configure PostGIS Raster on Windows « GIS4Freedom Blog

Leave a Reply

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

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

Google photo

You are commenting using your Google 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

%d bloggers like this: