bagrball
bagrball

Reputation: 11

Show raster from postgis via mapserver

I would like to show raster from database. I read article How can I add a PostGIS raster layer to my MapServer map? and created mapfile according by this. I get 500 - Internal server error.

When I display this raster in QGIS via PostGIS, the error message from mapserver is empty. I can read with mapserver to show vector data from the same database.

Have you some idea how solve this?

Part of mapfile with layer:

LAYER
  NAME eroze_cp

  TYPE raster

  STATUS ON

  DATA "PG:host='localhost' port='5432' dbname='mydb' user='me' password='****' schema='myschema' table='myrast' mode='2'" 

  PROJECTION

    "init=epsg:102067"

  END 

  PROCESSING "NODATA=-9999"

  PROCESSING "SCALE=AUTO"

END

Upvotes: 0

Views: 2217

Answers (2)

Pete
Pete

Reputation: 10680

See the Example of WMS-T with PostGIS Tile Index for Raster Imagery from the Mapserver docs (there's another example at MapServer TILEINDEXes with Database RASTERS). With a Postgis-backed database, you create a TILEINDEX view. Then you add two layers to your mapfile, like so:

Tile Index layer:

LAYER
  name raster_tindex
  TYPE polygon
  PROJECTION
    "init=epsg:xxxx"
  END
  CONNECTIONTYPE ORACLESPATIAL
  CONNECTION "user/pass@tns"
  DATA "geom FROM (
    SELECT gid, geom, location 
    FROM my_raster_tindex_table
  ) AS subquery using unique gid USING SRID=4326"
END

Second layer which is the actual RASTER layer

LAYER
  name db_raster_layer
  TYPE RASTER
  PROJECTION
    "init=epsg:xxxx"
  END
  TILEINDEX "raster_tindex"   #THIS NAME MUST MATCH THE TILEINDEX LAYER NAME
  TILEITEM "location"   #not actually needed if column is named location
  STATUS OFF
  OFFSITE 0 0 0
END

You can filter on TIME by adding a FILTER to db_raster_layer, as with the WMS-T example in the MapServer docs. However, a FILTER on properties/attributes of the data should live on the Tile Index (ie. in the raster_tindex layer), as mentioned by Frank Warmerdam in ogr tileindex with postgis?

Upvotes: 0

Stephen Woodbridge
Stephen Woodbridge

Reputation: 1110

one thing you can try is to use shp2img at the command line, to get more info about errors.

Look at: http://postgis.net/docs/RT_FAQ.html#idp35570592

You appear to have extra quotes in the connection string, althought I'm not sure if that matters.

Upvotes: 0

Related Questions