[postgis-users] View PostGIS raster in mapserver

Salvatore Larosa lrssvtml at gmail.com
Sat Mar 17 04:41:29 PDT 2012


Hi,
you might you try:

SELECT ST_SummaryStats(rast) FROM table

and paste the result here!

then, add this to your mapfile in LAYER block:

CONFIG MS_ERRORFILE "stderr"
DEBUG 10

run shp2img and paste the output here!

to see if it's an error postgis or mapserver!

I had the same problem and I solved it by adding

PROCESSING "RESAMPLE=NEAREST"

in LAYER block!

Regards

-SL


Il giorno sab, 17/03/2012 alle 03.40 -0700, Hemin ha scritto:
> Hi,
>  
> I try to use PostGIS 2.0 to convert a PostGIS geometry (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