[postgis-users] ST_Mapalgebraexpr requires same alignment
Pierre Racine
Pierre.Racine at sbf.ulaval.ca
Fri Mar 23 07:59:03 PDT 2012
> I though same alignment was not required because the docs said the alignment
> is chosen from first raster, then I guessed the second raster could have different
> alignment. I guessed it can support different alignment because otherwise I
> think its very limited, maybe Im doing something wrong though but the normal
> scenario its to make spatial analysis with raster which have different alignment.
I agree that the doc is not that clear. I took a note.
> How can I rewrite the sentence with raster which have different alignment? or I
> should re-sample the whole raster to make them to have the same alignment?
>
> insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast),
> 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null,
> null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate
> (d1.rast::geometry, d2.rast::geometry, 'T********') group by d1.rid;
I understand that they are in the same SRID but not aligned. This is two different things.
It all depends if your raster table is tiled or not. If it's not tiled just ST_Resample(rast, ref) before passing to ST_MapAlgebra(). If it is tiled, resampling generate much overlapping nodata values. PostGIS Raster normally deal well with that but it generates much useless nodata value processing. I would suggest to merge outside, resample/reproject with GDAL and reload tiled.
Pierre
More information about the postgis-users
mailing list