<div dir="ltr">Hi,<div><br></div><div>Thank you for the tips. </div><div><br></div><div>Well, I don't know why, but the st_clip function doesn't seem work fine. </div><div>After clipping and dumping each pixel as point, some points follow tiles, others follow the geometry. Any idea why ?</div><div>For now, to avoid the problem, I apply a St_ContainsProperly after the dump.</div><div><br></div><img src="cid:155fd74c31fd0cad2201" alt="pasted1" class="" style="max-width: 100%; opacity: 1;"><div><div class="GmSign">Red : geometry</div><div class="GmSign">Light blue : tiles</div><div class="GmSign">Dark blue : pixels as points</div><div class="GmSign"><br></div><div class="GmSign">Thank you for your help !<br><br>Pierre <br></div><div class="GmSign"><br></div><div class="GmSign">-- <br><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><div dir="ltr"><font color="#999999">Pierre Bails<br>GIS Engineer<br></font></div></div><div dir="ltr" style="font-size:12.8px"><br></div><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px;color:rgb(136,136,136)"><font color="#999999"><b>Redbird</b></font></div></div></div></div></div></div><span style="color:rgb(153,153,153);font-size:12.8px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">EMEA - 16, rue de la Comète - 75007 Paris - France</span><div><font color="#999999" style="font-size:small;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">US - </font><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;color:rgb(136,136,136);font-size:12.8px">44 Tehama St, San Francisco, CA 94105 - USA</span><div><div dir="ltr"><div dir="ltr"><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px;color:rgb(136,136,136)"><div style="color:rgb(33,33,33);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px"><div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" style="font-size:12.8px"><div style="font-size:12.8px"><div style="font-size:small"><font style="font-size:12.8px;font-family:arial,sans-serif;line-height:normal;color:rgb(136,136,136)">Mobile: +33 677 375 851</font><font style="font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)"> | </font><span style="font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">US </span><font style="font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">Office</font><span style="font-size:12.8px;font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">: +1 415 366 0191 </span><span style="font-size:12.8px;font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">| </span><span style="font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">FR </span><span style="font-size:12.8px;font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">O</span><span style="font-family:arial,sans-serif;line-height:normal;color:rgb(153,153,153)">ffice: +33 184 165 201</span><br></div></div></div></div></div></div></div></div></div></div></div><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px;color:rgb(136,136,136)"><a href="mailto:bails@getredbird.com" style="color:rgb(17,85,204)" target="_blank">bails@getredbird.com</a><font color="#888888"> | </font><a href="http://www.getredbird.com/" style="color:rgb(17,85,204)" target="_blank">www.getredbird.com</a><font color="#888888"> | </font><a href="https://www.facebook.com/redbird.drones" style="color:rgb(17,85,204)" target="_blank">Facebook</a><font color="#888888"> | </font><a href="https://twitter.com/redbirdHQ" style="color:rgb(17,85,204)" target="_blank">Twitter</a><font color="#888888"> </font><span style="font-size:12.8px">| </span><font color="#0000ff"><a href="https://www.youtube.com/channel/UC9ab5NnNorfVcRdynbTzSLw/videos" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:12.8px">Y</span>outube</a></font></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le ven. 15 juil. 2016 à 17:28, Pierre Racine <<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the late answer.<br>
<br>
You have to vectorize them on the fly from within OpenJump:<br>
<br>
SELECT (ST_DumpAsPolygons(rast).* FROM yourrastertable;<br>
<br>
If your raster is very big and tiled, just vectorize the tiles you need:<br>
<br>
SELECT rid, rast::geometry FROM yourrastertable;<br>
<br>
Look at the rids and then:<br>
<br>
SELECT (ST_DumpAsPolygons(rast).* FROM yourrastertable<br>
WHERE rid = x or rid = y<br>
<br>
Pierre<br>
<br>
> -----Original Message-----<br>
> From: postgis-users [mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] On Behalf<br>
> Of Pierre Bails<br>
> Sent: Friday, June 24, 2016 12:32 PM<br>
> To: PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br>
> Subject: Re: [postgis-users] Raster tile size impact results<br>
><br>
> Hello,<br>
><br>
> Unfortunatly, I don't find a way to print raster results in OpenJump. Can you<br>
> explain me how I can do it ?<br>
><br>
> Thank you for your help !<br>
><br>
> Pierre<br>
><br>
> Le lun. 20 juin 2016 à 16:16, Pierre Racine <<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a><br>
> <mailto:<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a>> > a écrit :<br>
><br>
><br>
>       I would try to understand, visually using OpenJump, how your tiles are<br>
> clipped in the two cases... I guess sometimes 1 pixel wide tiles get clipped in a<br>
> strange way.<br>
><br>
>       Pierre<br>
><br>
>       > -----Original Message-----<br>
>       > From: postgis-users [mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a><br>
> <mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>> ] On Behalf<br>
>       > Of Pierre Bails<br>
>       > Sent: Wednesday, June 15, 2016 11:41 AM<br>
>       > To: <a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a> <mailto:<a href="mailto:postgis-" target="_blank">postgis-</a><br>
> <a href="mailto:users@lists.osgeo.org" target="_blank">users@lists.osgeo.org</a>><br>
>       > Subject: [postgis-users] Raster tile size impact results<br>
>       ><br>
>       > Hi all,<br>
>       ><br>
>       > I'm looking for get all pixel's value in a raster insert thanks to<br>
> raster2pgsql<br>
>       > intersect by a polygon.<br>
>       > Nevertheless, there are some things that I don't understand: depends<br>
> on tile<br>
>       > size, I don't have the same result... The error between 2 raster is also<br>
> correlate<br>
>       > to the pixel size (I assume it's due to the pixel number).<br>
>       ><br>
>       > Can you explain me how the tile size can influence the final result ?<br>
>       ><br>
>       > Here is the query :<br>
>       > SELECT DISTINCT SUM((px).val)<br>
>       > FROM(<br>
>       >   SELECT *<br>
>       >   FROM  mns INNER JOIN<br>
>       ><br>
> st_setsrid(st_geomfromgeojson('{"type":"Polygon","coordinates":[[[x,y],[x,y],[x<br>
>       > ,y] ]]}'), 4326) as geom on ST_Intersects(mns.rast, geom)<br>
>       > ) AS clip, ST_PixelAsCentroids (ST_Clip(clip.rast, clip.geom),1) AS px;<br>
>       ><br>
>       ><br>
>       > DSM px size 70cm:<br>
>       > raster2pgsql -a -t 250x250 -s 4326 -F pathToDSM.tiff dsmTable (result:<br>
> 46 347<br>
>       > 846)<br>
>       ><br>
>       > raster2pgsql -a -t 50x50 -s 4326 -F pathToDSM.tiff dsmTable    : 46 382<br>
> 873<br>
>       > Difference: 35027<br>
>       ><br>
>       ><br>
>       > DSM px size 20cm :<br>
>       > raster2pgsql -a -t 250x250 -s 4326 -F pathToDSM.tiff dsmTable :  567<br>
> 505 888<br>
>       ><br>
>       > raster2pgsql -a -t 50x50 -s 4326 -F pathToDSM.tiff dsmTable    : 596<br>
> 897 610<br>
>       > Difference: 29 391 722<br>
>       ><br>
>       ><br>
>       > If we considere 250x250's result as reference, there is a difference of<br>
> 0.07% in<br>
>       > the first case, and 5% in the second. If the polygon area increases, the<br>
> error rate<br>
>       > increases.<br>
>       ><br>
>       > Thank you,<br>
>       ><br>
>       > Pierre<br>
>       _______________________________________________<br>
>       postgis-users mailing list<br>
>       <a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a> <mailto:<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br>
>       <a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div></div>