<div dir="ltr">Bborie, <br><br>I am running PostGIS 2.1.5. Here is the output of the postgis_full_version():<br><div><br>"POSTGIS="2.1.5 r13152" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.8.0" LIBJSON="UNKNOWN" RASTER"<br><br></div><div>My query looks like this:<br><br>SELECT ST_Intersection(ST_GeomFromText('POLYGON ((-52.54178994517749 46.99199259385565, -52.54178994517749 46.996897959881, -52.53436080387823 46.996897959881, -52.53436080387823 46.99199259385565, -52.54178994517749 46.99199259385565))', 4269), rast) as rast<br>FROM elev<br></div><div><br></div><div>David,<br><br></div><div>This query does not returns all the polygons that intersect my polygon. I think it returns only those where the centroid is inside the polygon or is it covered based? (like 50% of the pixel intersect with the polygon).<br></div><div><br></div><div>Thanks for your rapid answers!<br></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">Jean<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-05 14:31 GMT-08:00 David Haynes <span dir="ltr"><<a href="mailto:haynesd2@gmail.com" target="_blank">haynesd2@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">select ST_Clip(r.rast,p.geom) as rast<div>from polygon p inner join raster r on ST_intersects(r.rast, p.geom)</div><div><br></div><div>This returns a raster which has all pixels inside the polygon</div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Feb 5, 2015 at 4:05 PM, Jean Marchal <span dir="ltr"><<a href="mailto:jean.d.marchal@gmail.com" target="_blank">jean.d.marchal@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi list,<br></div><div><br>I am trying to return all the pixels in a raster that intersect (not just touch) an extent (say a rectangle). I tried ST_Clip and ST_Intersection(raster, geom) but they don't return all the pixels that intersect my extent polygon. Do I have to vectorize the raster first using ST_PixelAsPolygons or there is a better / more efficient way to proceed? <br><br></div><div>Ultimately the goal is to fetch the resulting raster in R.<br><br></div><div>Thanks,<br></div><div><br>Jean<br></div></div>
<br></div></div><span class="">_______________________________________________<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/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></span></blockquote></div><br></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div></div></div>