[mapserver-users] Render PostGIS points as raster layer

Adam Ryan adamdryan at gmail.com
Tue Sep 15 16:36:29 PDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150915/ff5338fd/attachment.html>


More information about the mapserver-users mailing list