[postgis-users] Best practices for PostGIS raster query and processing from web app

Tim Meehan tmeeha at gmail.com
Tue Apr 9 14:23:49 PDT 2013

Thanks for your help, Pierre.  Some follow up questions or answers:

Pixel selection is possible via three options:
> 1) one raster ST_MapAlgebra
> 2) ST_Reclass
> 3) ST_DumpAsPolygons (with a where clause)

OK, we will test the different approaches to see what works best/fastest.
When a query refers to multiple raster layers (e.g., select pixels with
slope = x, elevation = y, landcover = z), I suppose you would use multiple
calls to one-raster ST_MapAlgebra or a combination of one- and two-raster?

It is possible to build a distance raster in the database. It is a slow
> operation. But if your data is kind of static you can do it outside. What
> do you want exactly? The nearest pixels to a rail?

We are after a raster layer that has a distance via highway to the nearest
railroad for each raster cell.  That way a user can query cells based on
their own distance threshold of interest.  Looks like the best way is to
precompute distance and conduct queries on this value.

Try the new optimized callback map algebra:
> http://postgis.net/docs/manual-dev/RT_ST_MapAlgebra.html
> You might have to upgrade as it was optimized very recently.

Does this mean switch to PostGIS 2.1, or use the latest 2.0.3?

Test needed. If the pixel selected do not involve all the tiles of a tiled
> raster you might gain a lot by tiling.

Pixels of interest will likely be found across the spatial extent of the
database.  And they will come in many small clusters.  So it sounds like
having few tiles and sticking with rasters over vectors is the best way to
go.  Currently we have no tiles.  Is this sensible?

All in all, it sounds like 'best practices' often depends on the
idiosyncracies of the database.  Thanks for the outlining the
possibilities.  We will start testing different approaches and will update
the post with context and results as we go.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130409/442fa3fd/attachment.html>

More information about the postgis-users mailing list