As a simple test case, I'm trying to configure the software stack of OpenGeo such that I can display a GeoTIFF as an overlay to a normal map like OSM. So I perform the following steps:

  1. Create a spatial data base with postGIS
  2. Load the GeoTIFF into the data base
  3. Import the data base to GeoServer
  4. Preview it as a map overlay in GeoServer (e.g. with GeoExplorer or OpenLayers)

In contrary to a direct import of the GeoTIFF to Geoserver (which works formidably), the table imported from the data base is marked as "vector data" and not "raster data" in the GeoServer web application. In the Layer Preview, GeoExplorer does not display anything from the GeoTIFF and OpenLayers returns a WMS file reporting a ServiceExeption:

The requested Style can not be used with this layer.
The style specifies an attribute of geom and the layer is: opengeo:test

I believe the solution is quite simple but it seems I do not understand how GeoServer interprets raster data stored in postGIS.

Can anybody tell me what point I'm missing?

My steps in detail:

  1. Create a spatial data base with postGIS as documented, taking template_postgis as a template and port 5432 as I operate on Ubuntu 12.04.
  2. Load the GeoTIFF into the data base from the command line using raster2pgsql as in (http://suite.opengeo.org/docs/dataadmin/pgGettingStarted/raster2pgsql.html)

    raster2pgsql -I -C -s 32632 test.tif public.testTable
    | psql -d test -h localhost -U opengeo


    • -I: flag to create the spatial GiST index for performance
    • -C: flag to apply the raster constraints
    • -s 32632: SRID of test.tif reported by tool gdalinfo
    • test.tif: proper test GeoTIFF
    • public.testTable: new table in target schema
    • -d test: spatially enabled database
    • -U opengeo: owner of database (standard username)
  3. Import the data base to GeoServer as described in the official workshop

1 Answer 1


Install the Image Mosaic JDBC plugin

A GeoServer webpage hints at the root of the problem:

GeoServer does not come built-in with support for Postgis raster columns, it must be installed through an extension. Proceed to Image Mosaic JDBC for installation details. This extension includes the support for Postgis raster.

I followed the complex setup instructions there and managed to add an ImageMosaicJDBC Raster Data Source to my GeoServer.

Convert the GeoTIFF to 8bit

When it comes to serving/previewing the layer, the data does not get displayed properly as also experienced by another user [1]. As described there, a prior conversion of the GeoTIFF file from data type INT16 to BYTE resolved the issue (to the price of lower colour depth). The conversion can be done using the command-line tool gdal_translate:

$ gdal_translate -ot BYTE input.tif output.tif


You need the use the cumbersome ImageMosaicJDBC plugin and 8bit GeoTiffs to get the thing working. I did not find out why the preview modules (openLayer, GeoExt, JPEG preview,...) don't work with 16bit color depth. For the moment I agree on the comment that "PostGIS raster doesn't yet have that level of production use" [2].

[1] blank preview image for ImageMosaicJDBC (postgis raster) layer.

[2] Raster data on PostGIS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.