Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
    

    where

    • -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
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

Conclusion

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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