A small note regarding this issue.<div><br></div><div>My problem is that I never get a mean value of 1 even if all pixels inside the geometry is one.</div><div><br></div><div>Could this be because: 6x6 pixels goes into one polygon when visually controlling. If each pixel has the value 1, then this will be calculated as 36 / 36 = 1. However, if it calculates the sum to be 36 and divide by a number higher than 36 pixels, then the result will always be below 1.</div>
<div>What i am thinking is that while it sums up the pixel values correctly, it does not count only the 36 pixels, but also neighboring pixels. Therefore: 1+1+1+1...n36 / Number of pixels higher than 36 will always lead to a number lower than 1.</div>
<div><br></div><div>Anyone who knows the functions well could probably answer this.</div><div><br></div><div>Best regards,</div><div>Andreas</div><div><br><br><div class="gmail_quote">2011/11/25 Andreas Forĝ Tollefsen <span dir="ltr"><<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Could this have to do with the tiling of the raster?<div>I will try to run the same query with a untiled mountain raster to see if that changes anything.</div>
<div><br></div><div>Btw. When loading a tiled postgis raster into qgis it shows up with many artifacts and no data areas. The same raster untiled does not show up the same way.</div>
<div>Qgis bug?</div><div><br></div><font color="#888888"><div>Andreas</div></font><div><div></div><div class="h5"><div><br><div class="gmail_quote">2011/11/25 Andreas Forĝ Tollefsen <span dir="ltr"><<a href="mailto:andreasft@gmail.com" target="_blank">andreasft@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<br></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Thanks for all of the suggestions. I will do some more testing. However, as for suggestion 1 i think the pixel size should be the same as the original raster or am I wrong?</div>


<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Both the mean_mnt_bin raster and the priogrid_land shapefile can be downloaded as zip (2 mb) here: </div>


<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><a href="http://gisintersect.com/mean_mnt_bin.zip" style="color:rgb(64,100,128)" target="_blank">http://gisintersect.com/mean_mnt_bin.zip</a></div>


<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><a href="http://gisintersect.com/priogrid_land.zip" style="color:rgb(64,100,128)" target="_blank">http://gisintersect.com/priogrid_land.zip</a></div>


<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Any help on getting the correct values would be very much appreciated.</div>


<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">My query:</div>
<div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div>DROP TABLE IF EXISTS mountain_cell;</div><div><br></div><div>SELECT </div><div>a.gid As id,</div><div>(ST_SummaryStats((ST_Union(ST_MapAlgebraExpr(ST_AsRaster(a.cell, b.rast, '32BF'), b.rast, 'rast2', '32BF','INTERSECTION','0','0',0))).rast, false)).mean As avgmnt</div>


<div>INTO mountain_cell</div><div>FROM </div><div>priogrid_land a LEFT JOIN </div><div>mountain b</div><div>    ON ST_Intersects(a.cell, b.rast)</div><div>GROUP BY a.gid</div><div>ORDER BY a.gid;</div></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>