<div>Hi,<br></div><div><br></div><div>How can I perform ST_MapAlgebraExpr with raster layers that have different scale_x, scale_y. I suppose that the difference causes the two raster layers to be aligned differently</div><div>
<br></div><div>Joan</div><br><div class="gmail_quote">On 22 November 2011 17:27, Bborie Park <span dir="ltr"><<a href="mailto:bkpark@ucdavis.edu">bkpark@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Joan (and anyone else using 2-raster MapAlgebra),<br>
<br>
You don't need to specify ::double precision in your expressions.<br>
Under the hood, your expression is wrapped with parentheses and<br>
::double precision. So, if your expression was<br>
<br>
CASE WHEN rast2 > rast1 THEN rast1 ELSE rast2 END<br>
<br>
Internally, the expression becomes<br>
<br>
SELECT (CASE WHEN rast2 > rast1 THEN rast1 ELSE rast2 END)::double precision<br>
<span class="HOEnZb"><font color="#888888"><br>
-bborie<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, Nov 22, 2011 at 6:51 AM, Joan <<a href="mailto:wamaithajoan@gmail.com">wamaithajoan@gmail.com</a>> wrote:<br>
> I have tried it and it works. Thank you Pierre.<br>
><br>
> On 22 November 2011 15:33, Pierre Racine <<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>><br>
> wrote:<br>
>><br>
>> > I have used ST_MapAlgebraExpr but I get the error below.<br>
>> ><br>
>> ><br>
>> > select * from (select ST_MapAlgebraExpr(kb.rast, kb1.rast,<br>
>> > 'kb1.rast+kb.rast') as<br>
>> > rast from kb_dsm_clip kb, kb_dsm_clip100 kb1) as r1 limit 5;<br>
>> > ERROR: missing FROM-clause entry for table "kb1"<br>
>> > LINE 1: SELECT (KB1.RAST+KB.RAST)::double precision ^<br>
>> > QUERY: SELECT (KB1.RAST+KB.RAST)::double precision<br>
>><br>
>> Try this instead:<br>
>><br>
>> SELECT ST_MapAlgebraExpr(kb.rast, kb1.rast, 'rast1 + rast2') as rast<br>
>> FROM kb_dsm_clip kb, kb_dsm_clip100 kb1<br>
>> WHERE st_intersects(kb.rast, kb1.rast)<br>
>><br>
>> 1) There is no need for a subquery<br>
>><br>
>> 2) You must refer to the raster using 'rast1' and 'rast2', not their real<br>
>> names<br>
>><br>
>> 3) I don't know if your rasters are tiled but it is always a good idea to<br>
>> restrict the process to intersecting footprints.<br>
>><br>
>> Pierre<br>
>> _______________________________________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div><div class="im HOEnZb">--<br>
Bborie Park<br>
Programmer<br>
Center for Vectorborne Diseases<br>
UC Davis<br>
530-752-8380<br>
<a href="mailto:bkpark@ucdavis.edu">bkpark@ucdavis.edu</a><br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br>