<div dir="ltr">Hi Pierre,<div><br></div><div>I have the same problem with or without the rescale function...</div><div><br></div><div><br></div><div><div class="GmSign">-- <br><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><div dir="ltr"><font color="#999999">Pierre Bails<br><br></font></div></div></div></div></div><div><div><div dir="ltr"><div dir="ltr"><div dir="ltr" style="font-size:12.8px"></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 9 août 2016 à 14:30, 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">What if you remove the ST_Rescale() ?<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: Thursday, July 28, 2016 4:28 AM<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>
> Hi,<br>
><br>
> The full request is :<br>
><br>
> SELECT DISTINCT ST_AsGeojson(ST_Union((px.geom),4326))<br>
> FROM (<br>
> SELECT *<br>
> FROM dsm<br>
> INNER JOIN<br>
> ST_SetSRID(ST_MakeValid(ST_GeomFromGeojson('{"type":"Polygon","coordinat<br>
> es":[[[],[],[],[],[],[]]]}')), 4326) AS geom on ST_Intersects(dsm.rast, geom)<br>
> ) AS inter,<br>
> ST_PixelAsCentroids (ST_Clip(ST_Rescale(inter.rast, 0.5), inter.geom),1) as px<br>
><br>
><br>
> Thanks,<br>
><br>
> Pierre<br>
><br>
> --<br>
><br>
> Pierre Bails<br>
> GIS Engineer<br>
><br>
><br>
> Redbird<br>
> EMEA - 16, rue de la Comète - 75007 Paris - France<br>
> US - 44 Tehama St, San Francisco, CA 94105 - USA<br>
> Mobile: +33 677 375 851 | US Office: +1 415 366 0191 | FR Office: +33 184 165<br>
> 201<br>
><br>
> <a href="mailto:bails@getredbird.com" target="_blank">bails@getredbird.com</a> <mailto:<a href="mailto:bails@getredbird.com" target="_blank">bails@getredbird.com</a>> | <a href="http://www.getredbird.com" rel="noreferrer" target="_blank">www.getredbird.com</a><br>
> <<a href="http://www.getredbird.com/" rel="noreferrer" target="_blank">http://www.getredbird.com/</a>> | Facebook<br>
> <<a href="https://www.facebook.com/redbird.drones" rel="noreferrer" target="_blank">https://www.facebook.com/redbird.drones</a>> | Twitter<br>
> <<a href="https://twitter.com/redbirdHQ" rel="noreferrer" target="_blank">https://twitter.com/redbirdHQ</a>> | Youtube<br>
> <<a href="https://www.youtube.com/channel/UC9ab5NnNorfVcRdynbTzSLw/videos" rel="noreferrer" target="_blank">https://www.youtube.com/channel/UC9ab5NnNorfVcRdynbTzSLw/videos</a>><br>
><br>
> Le lun. 25 juil. 2016 à 21:30, 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 will need to see your last query to try to find the problem.<br>
><br>
><br>
><br>
> Pierre<br>
><br>
><br>
><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 Of Pierre Bails<br>
> Sent: Wednesday, July 20, 2016 5:36 AM<br>
><br>
><br>
> To: PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
> <mailto:<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>
><br>
><br>
> Hi,<br>
><br>
><br>
><br>
> Thank you for the tips.<br>
><br>
><br>
><br>
> Well, I don't know why, but the st_clip function doesn't seem work fine.<br>
><br>
> After clipping and dumping each pixel as point, some points follow tiles,<br>
> others follow the geometry. Any idea why ?<br>
><br>
> For now, to avoid the problem, I apply a St_ContainsProperly after the<br>
> dump.<br>
><br>
><br>
><br>
><br>
><br>
><br>
> Red : geometry<br>
><br>
> Light blue : tiles<br>
><br>
> Dark blue : pixels as points<br>
><br>
><br>
><br>
> Thank you for your help !<br>
><br>
><br>
><br>
> Pierre<br>
><br>
><br>
><br>
><br>
><br>
> Le ven. 15 juil. 2016 à 17:28, 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>
> 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<br>
> 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-" target="_blank">postgis-users-</a><br>
> <a href="mailto:bounces@lists.osgeo.org" target="_blank">bounces@lists.osgeo.org</a> <mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>> ] On<br>
> 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>
> <mailto:<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<br>
> 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<br>
> <<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a> <mailto:<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><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<br>
> your tiles are<br>
> > clipped in the two cases... I guess sometimes 1 pixel wide tiles<br>
> get clipped in a<br>
> > strange way.<br>
> ><br>
> > Pierre<br>
> ><br>
> > > -----Original Message-----<br>
> > > From: postgis-users [mailto:<a href="mailto:postgis-users-" target="_blank">postgis-users-</a><br>
> <a href="mailto:bounces@lists.osgeo.org" target="_blank">bounces@lists.osgeo.org</a> <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><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>> <mailto:<a href="mailto:postgis-" target="_blank">postgis-</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> <mailto:<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<br>
> thanks to<br>
> > raster2pgsql<br>
> > > intersect by a polygon.<br>
> > > Nevertheless, there are some things that I don't<br>
> understand: depends<br>
> > on tile<br>
> > > size, I don't have the same result... The error between 2<br>
> 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<br>
> 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>
> ><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,<br>
> clip.geom),1) AS px;<br>
> > ><br>
> > ><br>
> > > DSM px size 70cm:<br>
> > > raster2pgsql -a -t 250x250 -s 4326 -F pathToDSM.tiff<br>
> dsmTable (result:<br>
> > 46 347<br>
> > > 846)<br>
> > ><br>
> > > raster2pgsql -a -t 50x50 -s 4326 -F pathToDSM.tiff<br>
> 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<br>
> dsmTable : 567<br>
> > 505 888<br>
> > ><br>
> > > raster2pgsql -a -t 50x50 -s 4326 -F pathToDSM.tiff<br>
> dsmTable : 596<br>
> > 897 610<br>
> > > Difference: 29 391 722<br>
> > ><br>
> > ><br>
> > > If we considere 250x250's result as reference, there is a<br>
> difference of<br>
> > 0.07% in<br>
> > > the first case, and 5% in the second. If the polygon area<br>
> 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-" target="_blank">postgis-</a><br>
> <a href="mailto:users@lists.osgeo.org" target="_blank">users@lists.osgeo.org</a>> <mailto:<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>
> > <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> <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>
> <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> <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>