<div dir="ltr">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:<div><br></div><div><div><div>LAYER</div><div>    ...</div><div>    TYPE POLYGON</div><div>    CONNECTIONTYPE POSTGIS </div><div>    CONNECTION [host, port, etc...]</div></div></div><div>    DATA "geom FROM (SELECT id, ST_Expand( geom, 0.005 ) as geom from [query]) as foo using unique id using srid=4326"<br></div><div>    ...</div><div><br></div><div>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.</div><div><br></div><div>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: </div><div><br></div><div><div>LAYER</div><div>    ...</div><div>    TYPE RASTER</div></div><div><div>    DATA "PG:host=[host] port=5432 dbname=[dbname] where=' where?</div></div><div><br></div><div>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.</div><div><br></div><div>Is there a way to do this?  Would a GDAL virtual raster be able to accomplish this?  I've never worked with them.</div><div><br></div><div>Thanks for the all the progress over the years,</div><div>Adam</div></div>