<div>Hi Tom, <br></div><div><br></div><div>Thanks for the help, the query now runs. There are no other quotes in the query.</div><div><br></div><div>Regards</div><div><br></div><div>Joan</div><br><div class="gmail_quote">On 22 November 2011 15:16, Tom van Tilburg <span dir="ltr"><<a href="mailto:tom.van.tilburg@gmail.com">tom.van.tilburg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF" text="#000000">
Joan,<br>
<br>
I think your expression is wrong.<br>
<span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE">'kb1.rast+kb.rast'</span> <br>
should be: <br>
'rast1+rast2'<br>
<br>
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?<br>
<br>
Chrs,<br>
Tom<div><div class="h5"><br>
<br>
On 22-11-2011 14:24, Joan wrote:
<blockquote type="cite">
<div>Hi Bborie,<br>
</div>
<div><br>
</div>
<div>I have used ST_MapAlgebraExpr but I get the error below. </div>
<div><br>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE">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;<br>
ERROR: missing FROM-clause entry for table "kb1"<br>
LINE 1: SELECT (KB1.RAST+KB.RAST)::double precision<br>
^<br>
QUERY: SELECT (KB1.RAST+KB.RAST)::double precision</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE"><span>
</span>^</span></p>
</div>
<div><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE"><br>
</span></div>
<div><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE"><font face="arial,helvetica,sans-serif">At what
point should I add :: double precision, I added it like this
and also got an error.</font><font face="arial,helvetica,sans-serif"><br>
</font></span></div>
<div><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE"><font face="arial,helvetica,sans-serif"><br>
</font></span></div>
<div><span style="font-size:10.0pt;line-height:115%;font-family:"Courier New"" lang="DE">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;<br>
ERROR: cannot cast type raster to double precision<br>
LINE 1: ...AlgebraExpr(kb.rast, kb1.rast,
'kb1.rast+kb.rast')::double p...<br>
^<br>
</span></div>
<div>
<br>
</div>
<div>Regards </div>
<div><br>
</div>
<div>Joan<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div class="gmail_quote">On 21 November 2011 16:06, Bborie Park <span dir="ltr"><<a href="mailto:bkpark@ucdavis.edu" target="_blank">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">
<div>
<div>On Mon, Nov 21, 2011 at 7:02 AM, Joan <<a href="mailto:wamaithajoan@gmail.com" target="_blank">wamaithajoan@gmail.com</a>>
wrote:<br>
> Hello,<br>
><br>
> When I run the following query<br>
> select ST_MapAlgebra(r1.rast, r2.rast, "rast1 +
rast2") from (select<br>
> r1.rast, r2.rast from r1, r2) as foo limit 10;<br>
> I get this error<br>
> ERROR: column "rast + rast" does not exist<br>
> LINE 1: ...t * from (select ST_MapAlgebra(r1.rast,
r2.rast, "rast + ra...<br>
> ^<br>
> What could be the problem? What is the correct syntax
for st_mapalgebra?<br>
> I have PostGIS installed the version updated on 18th
Nov 2011.<br>
><br>
> Joan<br>
<br>
</div>
</div>
Hey Joan,<br>
<br>
You'll want to use ST_MapAlgebraExpr or ST_MapAlgebraFct.<br>
<br>
<a href="http://postgis.refractions.net/documentation/manual-svn/RT_reference.html#Raster_Processing" target="_blank">http://postgis.refractions.net/documentation/manual-svn/RT_reference.html#Raster_Processing</a><br>
<span><font color="#888888"><br>
-bborie<br>
<br>
--<br>
Bborie Park<br>
Programmer<br>
Center for Vectorborne Diseases<br>
UC Davis<br>
530-752-8380<br>
<a href="mailto:bkpark@ucdavis.edu" target="_blank">bkpark@ucdavis.edu</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">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>
</font></span></blockquote>
</div>
<br>
<br>
<br>
<pre>_______________________________________________
postgis-users mailing list
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre> </blockquote>
<br>
</div></div></div>
<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></blockquote></div><br>