Great.<br><br>I have some ArcGIS and GRASS -- I'll see what their restrictions are, and use that as a guideline for now.<br><br>On a side note, I emailed Even, and he was kind enough to provide code for his expression parser.<br>
<br>Zwarg<br><br><div class="gmail_quote">On Tue, Feb 9, 2010 at 4:29 PM, Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">









<div link="blue" vlink="purple" lang="EN-US">

<div>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">This is a good question…</span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I guess users would expect the same kind of result as in any GIS
package: The pixel values used to compute the mathematical expression SHOULD spatially
overlap.</span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">For operations like this in general, PostGIS assume that
involved layers are in the same coordinate system. There is no such things as
automatic on the fly layer reprojection. I don’t remember if it warn you
if it you attempt an operation on two layers projected in two different CS. </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Now what to do when the rasters ovelaps but the pixel sizes are
different? Or when they have different rotations? What does GRASS does? What
does ArcGIS does? Whar R does? I would definitely play with those before designing
anything. We should design the rules involved in this kind of function so we
can reuse them when we are confronted to similar alignment problem in other functions
(Intersection(raster, raster)->raster, ST_Difference(raster A, raster B)->raster,
i.e. most functions taking two or more overlapping rasters and returning one
raster). </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">You also always have to decide what will be the CS, alignment and
pixel size of the resulting raster. You can impose the ones of one of the
raster involved (the “master raster”) with an integer parameter
specifying the index of the “master raster”. You could also supply
variant of the function allowing to specify these params. Do we want to
realign/resample slave rasters before doing te operation. This does not seems
very efficient but maybe there is no other real avenue.</span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">For sure the challenge is huge. I would maybe start by
implementing supports for operations on a single raster, delaying problems of
alignment for later.</span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Pierre</span></p>

<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 4pt;">

<div>

<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">

<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
<a href="mailto:postgis-devel-bounces@postgis.refractions.net" target="_blank">postgis-devel-bounces@postgis.refractions.net</a>
[mailto:<a href="mailto:postgis-devel-bounces@postgis.refractions.net" target="_blank">postgis-devel-bounces@postgis.refractions.net</a>] <b>On Behalf Of </b>David
Zwarg<br>
<b>Sent:</b> 9 février 2010 15:54<br>
<b>To:</b> PostGIS Development Discussion<br>
<b>Subject:</b> [postgis-devel] WKTRaster ST_MapAlgebra</span></p>

</div>

</div><div><div></div><div class="h5">

<p class="MsoNormal"> </p>

<p class="MsoNormal">Greetings,<br>
<br>
I was reviewing the working spec (<a href="http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking03" target="_blank">http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking03</a>),
and thinking about ST_MapAlgebra:<br>
<br>
<b>ST_MapAlgebra(raster|geometry, [raster|geometry,…],
‘mathematical expression’, ‘raster’
|’geometry’) -> raster/geometry</b><br>
<br>
I am considering the following question in the context of using ST_MapAlgebra
with rasters, and returning a raster. Should this function only perform
operations on similar rasters?  Meaning: do the georeferencing, spatial
reference, and pixel size have to be the same in all input rasters?<br>
<br>
Thanks,<br>
Zwarg</p>

</div></div></div>

</div>

</div>


<br>_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@postgis.refractions.net">postgis-devel@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-devel" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-devel</a><br>
<br></blockquote></div><br>