[postgis-devel] ST_MapAlgebraExpr: Wrong output for Y-data with 'UNION'

Tom van Tilburg tom.van.tilburg at gmail.com
Mon Nov 21 04:00:48 PST 2011


Hi List,

Can someone confirm wether I'm doing this wrong or the ST_MapAlgebraExpr 
is doing it wrong:
I have two overlapping rasters that I want to add to eachother. The 
non-overlapping parts should  be included as well and therefore I use 
'UNION' in the ST_MapalgebraExpr function.

This is my code:
====================
WITH sub as(
SELECT
     raster1.rast As rast1,
     raster2.rast As rast2,
     ST_MapAlgebraExpr(
         raster1.rast, 1,
         raster2.rast, 1,
         'rast1 + rast2'::text, NULL::text, 'UNION'::text,
         'rast2'::text, 'rast1'::text, NULL::Double precision
     ) As rast3
FROM
     raster1  ,raster2
)

SELECT
     ST_Ymin(St_Envelope(rast1)),
     ST_Ymax(St_Envelope(rast1)),
     ST_Ymin(St_Envelope(rast2)),
     ST_Ymax(St_Envelope(rast2)),
     ST_Ymin(St_Envelope(rast3)),
     ST_Ymax(St_Envelope(rast3))
FROM sub
;
=========================
Result:
Rast1 Ymin/Ymax
     443752.035; 456237.035;
Rast2 Ymin/Ymax
     446707.035; 456242.035;
Union Ymin/Ymax
     443747.035; 456237.035

Whereas the expected output would be:
Union Ymin/Ymax
     443752.035;456242.035

(The X-data is outputting correctly).

Regards,
  Tom



More information about the postgis-devel mailing list