[postgis-users] raster regions

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Jul 16 06:05:35 PDT 2019

Right. To minimize the amount of intermediate computation you can add a discriminant to the first query:

WITH floodareas AS (
  SELECT ST_MapAlgebra(rast, ‘1BB’, ‘CASE WHEN [rast] < 10 THEN 1 ELSE NULL END’) rast
  FROM elevation e, districts d
  WHERE ST_Intersects(d.geom, e.rast)
FROM districts d, floodareas f
WHERE ST_Intersects(d.geom, f.rast)

De : postgis-users <postgis-users-bounces at lists.osgeo.org> De la part de joao.cordeiro at inpe.br
Envoyé : 15 juillet 2019 14:40
À : postgis-users at lists.osgeo.org
Objet : Re: [postgis-users] raster regions

Thanks, Pierre,

It seems ok to model the query the way you showed, however, that implies the generation of an entire intermediate binary raster, just to identify the region inside the whole mapped area. My issue is on avoiding such intermediate data by incorporating map algebra expression into the same query expression, Another example, ""... d.geom touch (ndvi2018 < ndvi2019)" where ndvixxxx are raster data.


Em 15-07-2019 14:43, Pierre Racine escreveu:

That could translate into something like this in PostGIS:

WITH floodareas AS (
  SELECT ST_MapAlgebra(rast, ‘1BB’, ‘CASE WHEN [rast] < 10 THEN 1 ELSE NULL END’) rast
  FROM elevation
FROM districts d, floodareas f
WHERE ST_Intersects(g.geom, f.rast)

NULL becomes nodata values. You could also use ST_Reclass() instead of ST_Mapalgebra().


De : postgis-users <postgis-users-bounces at lists.osgeo.org<mailto:postgis-users-bounces at lists.osgeo.org>> De la part de Joao Cordeiro
Envoyé : 15 juillet 2019 10:19
À : 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>>
Objet : [postgis-users] raster regions

Hi there,

I am not actually a POSTGIS user, or developer, although I am doing some research of integration of vector -raster in a dbms context. My main question s about identifying regions represented in a domain like the "hybrid raster" so that they can be referred to in a query. For example, I would like to write something like "select d from districts where d.geometry touches flooding", where "flooding" indicates an expression intended to decide on the pertinence of locations to a flooding ​​risk area described, for instance through map algebra.

Thanks for any hints or suggestions.



postgis-users mailing list

postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190716/7e75975d/attachment.html>

More information about the postgis-users mailing list