[postgis-users] ST_Mapalgebra
Joan
wamaithajoan at gmail.com
Tue Nov 22 09:27:24 PST 2011
Hi,
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
Joan
On 22 November 2011 17:27, Bborie Park <bkpark at ucdavis.edu> wrote:
> Joan (and anyone else using 2-raster MapAlgebra),
>
> You don't need to specify ::double precision in your expressions.
> Under the hood, your expression is wrapped with parentheses and
> ::double precision. So, if your expression was
>
> CASE WHEN rast2 > rast1 THEN rast1 ELSE rast2 END
>
> Internally, the expression becomes
>
> SELECT (CASE WHEN rast2 > rast1 THEN rast1 ELSE rast2 END)::double
> precision
>
> -bborie
>
> On Tue, Nov 22, 2011 at 6:51 AM, Joan <wamaithajoan at gmail.com> wrote:
> > I have tried it and it works. Thank you Pierre.
> >
> > On 22 November 2011 15:33, Pierre Racine <Pierre.Racine at sbf.ulaval.ca>
> > wrote:
> >>
> >> > I have used ST_MapAlgebraExpr but I get the error below.
> >> >
> >> >
> >> > select * from (select ST_MapAlgebraExpr(kb.rast, kb1.rast,
> >> > 'kb1.rast+kb.rast') as
> >> > rast from kb_dsm_clip kb, kb_dsm_clip100 kb1) as r1 limit 5;
> >> > ERROR: missing FROM-clause entry for table "kb1"
> >> > LINE 1: SELECT (KB1.RAST+KB.RAST)::double precision ^
> >> > QUERY: SELECT (KB1.RAST+KB.RAST)::double precision
> >>
> >> Try this instead:
> >>
> >> SELECT ST_MapAlgebraExpr(kb.rast, kb1.rast, 'rast1 + rast2') as rast
> >> FROM kb_dsm_clip kb, kb_dsm_clip100 kb1
> >> WHERE st_intersects(kb.rast, kb1.rast)
> >>
> >> 1) There is no need for a subquery
> >>
> >> 2) You must refer to the raster using 'rast1' and 'rast2', not their
> real
> >> names
> >>
> >> 3) I don't know if your rasters are tiled but it is always a good idea
> to
> >> restrict the process to intersecting footprints.
> >>
> >> Pierre
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
>
>
>
> --
> Bborie Park
> Programmer
> Center for Vectorborne Diseases
> UC Davis
> 530-752-8380
> bkpark at ucdavis.edu
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111122/cd80bd73/attachment.html>
More information about the postgis-users
mailing list