[postgis-users] View PostGIS raster in mapserver

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon Mar 19 08:51:08 PDT 2012


Hemin ,

Can you gdal_translate raster.kommune_r to tif?

We know that the GDAL PostGIS Raster driver is dependent on a "rid" column. I suggest you rename "gid", "rid".

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Hemin
> Sent: Saturday, March 17, 2012 6:41 AM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] View PostGIS raster in mapserver
> 
> Hi,
> 
> I try to use PostGIS 2.0 to convert a PostGIS geometry (a table) to PostGIS raster
> and view the raster via Mapserver.
> 
> I use:
> a. postgis version
> "POSTGIS="2.0.0alpha3" GEOS="3.3.3dev-CAPI-1.7.3" PROJ="Rel. 4.6.1, 21
> August 2008" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8"
> USE_STATS"
> 
> b. Mapserver and GDAL version ( from MS4W  v3.0.4) MapServer CGI 6.0.2
> MapScript 6.0.2 (CSharp, Java, PHP, Python) GDAL/OGR 1.9.0 and Utilities
> 
> Steps:
> 1. create raster from pg table:
> create table raster.kommune_r as (SELECT ST_AsRaster((SELECT
> st_Union(wkb_geometry) FROM vector.kommune),
> 200,200,ARRAY['8BUI','8BUI', '8BUI'], ARRAY[100,100,100],
> ARRAY[50,50,50],704943, 6166793, 0, 0,false) as rast, 1 as gid );
> 
> 2. update srid (I noticed that the raster has no srid):
> update raster.kommune_r set rast = st_setsrid(rast, 25832);
> 
> 3.  define a Mapserver layer:
>    LAYER
>       NAME kommune_r
>       TYPE raster
>       STATUS ON
>       DATA "PG:host='localhost' port='5432' dbname='hto' user='hto'
> schema='raster' table='kommune_r' mode='2'"
>       class
>         name kommune_r
>         style
>           color 0 255 0
>         end
>       end
>       PROJECTION
>        "init=epsg:25832"
>       END
>   END
> 
> 
> The result is an empty *.png file.
> Du you have an idea about what is missing?
> 
> Thanks in advance.
> Hemin
> 
> 
> --
> View this message in context: http://postgis.17.n6.nabble.com/View-PostGIS-
> raster-in-mapserver-tp4627669p4627669.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list