<div dir="ltr"><div><div><div><div><div>Hi all<br></div>I'm just starting to discover postgis, it is really useful.<br></div>I have a raster file with different bands, that I have imported to postgres (raster2pgsql, without the -R option, i.e., insite the database). I would like to extract information from band 1, but filtering the data using only <br></div>1)  pixels with positive values (in that band, band 1)<br></div>2) and pixels in which band 2 is equal to a given value, e.g. 1<br><br></div>The type of analysis I'd like to do is descriptive stats but also intersecting with a vector map. If my raster is <span style="font-family:monospace,monospace">rastertmp.ndvitmp</span>, two examples are:<br><div><div><div><div><br><span style="font-family:monospace,monospace">SELECT (ST_SummaryStats(rast, 1)).* FROM rastertmp.ndvitmp WHERE rid = 1 </span><br><br><div><div><br><span style="font-family:monospace,monospace">SELECT p.region_cod, ST_ValueCount(ST_Clip(r.rast,1, p.geom, true)) AS res<br>  FROM gis_wd.wd_regiones AS p, rastertmp.ndvitmp AS r<br>  WHERE ST_Intersects(r.rast, p.geom) <br>  AND p.region_cod = 'PA1214';<br></span><br><br></div><div>This works perfectly, but how can I compute the stats  only for pixels with positive values and<span style="font-family:monospace,monospace"></span> with a given value in another band?  The idea would be something like:  WHERE ST_Values(<span style="font-family:monospace,monospace">rast, 1)>0 AND </span>ST_Values(<span style="font-family:monospace,monospace">rast, 2)=1<br></span></div><div><br></div><div>Thanks for any help!<br><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr">Juli<div><span style="color:rgb(51,51,153)">--</span><br><font color="#333399"><b>CIDE, CSIC</b>  |  <a href="http://www.uv.es/jgpausas" target="_blank">www.uv.es/jgpausas</a>  | <br><br></font></div></div></div></div></div></div>
</div></div></div></div></div></div></div>