通过mapserver从postgis显示栅格

时间:2015-01-28 10:22:36

标签: database postgis mapserver

我想从数据库中显示栅格。我读了文章How can I add a PostGIS raster layer to my MapServer map?并根据此创建了mapfile。我得到500 - 内部服务器错误。

当我通过PostGIS在QGIS中显示此栅格时,来自mapserver的错误消息为空。我可以使用mapserver来读取来自同一数据库的矢量数据。

你知道如何解决这个问题吗?

带有图层的mapfile的一部分:

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

2 个答案:

答案 0 :(得分:0)

您可以尝试的一件事是在命令行使用shp2img,以获取有关错误的更多信息。

看看: http://postgis.net/docs/RT_FAQ.html#idp35570592

你似乎在连接字符串中有额外的引号,虽然我不确定这是否重要。

答案 1 :(得分:0)

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 mscorlib view. Then you add two layers to your TILEINDEX, like so:

Tile Index layer:

mapfile

Second layer which is the actual RASTER 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

You can filter on TIME by adding a FILTER to 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 , 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 db_raster_layer layer), as mentioned by Frank Warmerdam in ogr tileindex with postgis?