<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I will need to see your last query to try to find the problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Pierre<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Pierre Bails<br>
<b>Sent:</b> Wednesday, July 20, 2016 5:36 AM<br>
<b>To:</b> PostGIS Users Discussion <postgis-users@lists.osgeo.org><br>
<b>Subject:</b> Re: [postgis-users] Raster tile size impact results<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Hi,</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Thank you for the tips. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Well, I don't know why, but the st_clip function doesn't seem work fine. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">After clipping and dumping each pixel as point, some points follow tiles, others follow the geometry. Any idea why ?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">For now, to avoid the problem, I apply a St_ContainsProperly after the dump.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121"><img width="118" height="166" style="width:1.2333in;height:1.7333in" id="_x0000_i1025" src="cid:image001.png@01D1E689.72394940" alt="unnamed.png"><o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Red : geometry<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Light blue : tiles<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#212121">Dark blue : pixels as points<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#757575"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal">Thank you for your help !<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Pierre<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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 :<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">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" 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" target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>