[mapserver-users] Render PostGIS points as raster layer

Michael Smith michael.smith.erdc at gmail.com
Tue Sep 15 16:59:02 PDT 2015


Would the simplest way be to just create a view and use that?

Michael Smith
Remote Sensing/GIS Center
US Army Corps of Engineers

> On Sep 16, 2015, at 8:36 AM, Adam Ryan <adamdryan at gmail.com> wrote:
> 
> I have over 100 million rows in a PG table with geom type Point, srid=4326.  The points represent timestamped centroids of raster cells.  The data comes from sparse hourly 1km US grids; Only the cells with data, which is less than 1%, but still a lot of points.  The PG table allows for a wealth of spatial-temporal queries, but I want to render as a raster because it is raster data after all.  Currently I use ST_Expand to approximate a grid cell as a polygon:
> 
> LAYER
>     ...
>     TYPE POLYGON
>     CONNECTIONTYPE POSTGIS 
>     CONNECTION [host, port, etc...]
>     DATA "geom FROM (SELECT id, ST_Expand( geom, 0.005 ) as geom from [query]) as foo using unique id using srid=4326"
>     ...
> 
> This works, sorta.  In my classifications I set the style COLOR and OUTLINECOLOR the same, but the overlapping 'cell' outlines never look as good as output from a raster.
> 
> So I want to use a mapserver layer type RASTER.  I can create a raster in PG by using ST_AsRaster, but I can't see how to pass it to mapserver: 
> 
> LAYER
>     ...
>     TYPE RASTER
>     DATA "PG:host=[host] port=5432 dbname=[dbname] where=' where?
> 
> The DATA (connection string) here takes a table name and a where but I really need it to take an SQL string that returns the correct type.
> 
> Is there a way to do this?  Would a GDAL virtual raster be able to accomplish this?  I've never worked with them.
> 
> Thanks for the all the progress over the years,
> Adam
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list