[postgis-users] ST_Mapalgebra

Tom van Tilburg tom.van.tilburg at gmail.com
Tue Nov 22 06:16:55 PST 2011


Joan,

I think your expression is wrong.
'kb1.rast+kb.rast'
should be:
'rast1+rast2'

Oddly enough, I would not expect this error message with that error, so 
I'm curious wether it will make a change. Could it be there is any more 
quotes in the query that we can't see?

Chrs,
  Tom

On 22-11-2011 14:24, Joan wrote:
> Hi Bborie,
>
> 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
>
> ^
>
>
> At what point should I add :: double precision, I added it like this 
> and also got an error.
>
> select * from (select ST_MapAlgebraExpr(kb.rast, kb1.rast, 
> 'kb1.rast+kb.rast')::double precision as rast from kb_dsm_clip kb, 
> kb_dsm_clip100 kb1) as r1 limit 5;
> ERROR: cannot cast type raster to double precision
> LINE 1: ...AlgebraExpr(kb.rast, kb1.rast, 'kb1.rast+kb.rast')::double p...
> ^
>
> Regards
>
> Joan
>
>
> On 21 November 2011 16:06, Bborie Park <bkpark at ucdavis.edu 
> <mailto:bkpark at ucdavis.edu>> wrote:
>
>     On Mon, Nov 21, 2011 at 7:02 AM, Joan <wamaithajoan at gmail.com
>     <mailto:wamaithajoan at gmail.com>> wrote:
>     > Hello,
>     >
>     > When I run the following query
>     > select ST_MapAlgebra(r1.rast, r2.rast, "rast1 + rast2") from (select
>     > r1.rast, r2.rast from r1, r2) as foo limit 10;
>     > I get this error
>     > ERROR: column "rast + rast" does not exist
>     > LINE 1: ...t * from (select ST_MapAlgebra(r1.rast, r2.rast,
>     "rast + ra...
>     > ^
>     > What could be the problem? What is the correct syntax for
>     st_mapalgebra?
>     > I have PostGIS installed the version updated on 18th Nov 2011.
>     >
>     > Joan
>
>     Hey Joan,
>
>     You'll want to use ST_MapAlgebraExpr or ST_MapAlgebraFct.
>
>     http://postgis.refractions.net/documentation/manual-svn/RT_reference.html#Raster_Processing
>
>     -bborie
>
>     --
>     Bborie Park
>     Programmer
>     Center for Vectorborne Diseases
>     UC Davis
>     530-752-8380
>     bkpark at ucdavis.edu <mailto:bkpark at ucdavis.edu>
>     _______________________________________________
>     postgis-users mailing list
>     postgis-users at postgis.refractions.net
>     <mailto: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111122/871c4094/attachment.html>


More information about the postgis-users mailing list