<font size=2 face="sans-serif">Clearly I misunderstood what the -t 20x20
switch meant in my raster2pgsql command</font>
<br><font size=2 face="sans-serif">I understand now that I have 400 pixels
by tile (rid).</font>
<br>
<br><font size=2 face="sans-serif">I need to intersects all pixel with
value = 9 with a multipolygon postgis layer. I'll see if my sql below will
do it</font>
<br>
<p>
<br>
<br>
<br>
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=40% style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif"><b>Steve.Toutant@inspq.qc.ca@lists.osgeo.org</b>
</font>
<br><font size=1 face="sans-serif">Envoyé par : "postgis-users"
<postgis-users-bounces@lists.osgeo.org></font>
<p><font size=1 face="sans-serif">2015-10-16 10:41</font>
<table width=169 style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=167 bgcolor=white style="border-style:solid solid solid solid;border-color:#000000;border-width:1px 1px 1px 1px;padding:0px 0px;">
<div align=center><font size=1 face="sans-serif">Veuillez répondre à<br>
PostGIS Users Discussion <postgis-users@lists.osgeo.org></font></div></table>
<br>
<td width=59% style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">A</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif">PostGIS
Users Discussion <postgis-users@lists.osgeo.org></font>
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif">[postgis-users]
select raster by pixel value</font></table>
<br>
<table width=393 style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<td width=336 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"></table>
<br></table>
<br>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Hi,</font><font size=3> </font><font size=2 face="sans-serif"><br>
First try on using raster in postgis 2.1. I used raster2pgsl to load a
tif.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Then I want to select the rids where pixel value = 9</font><font size=3>
</font><font size=2 face="sans-serif"><br>
I ended up with this query</font><font size=3> </font><font size=2 face="sans-serif"><br>
SELECT a.rid,(pvc).value <br>
from test as a <br>
join (SELECT rid,ST_ValueCount(rast) As pvc FROM test) as b ON b.rid =
a.rid and (pvc).value = 9 <br>
order by a.rid;</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
This select returns <b>28517 </b>records</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
But using this SQL to get the distinct count i get <b>1055421 </b>records
for pixel value 9</font><font size=3> </font><font size=2 face="sans-serif"><br>
SELECT (pvc).value, SUM((pvc).count) As total <br>
 FROM (SELECT ST_ValueCount(rast) As pvc <br>
   FROM test) As f <br>
    GROUP BY (pvc).value <br>
order by value;</font><font size=3> <br>
<br>
</font><font size=2 face="sans-serif"><br>
Obviously there is something I do wrong...</font><font size=3> </font><font size=2 face="sans-serif"><br>
What is it I don't understand?</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
thanks!</font><font size=3> <br>
<br>
<br>
</font><tt><font size=2>_______________________________________________<br>
postgis-users mailing list<br>
postgis-users@lists.osgeo.org<br>
</font></tt><a href="http://lists.osgeo.org/mailman/listinfo/postgis-users"><tt><font size=2>http://lists.osgeo.org/mailman/listinfo/postgis-users</font></tt></a>
<br>
<br>
<br>