<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>get unique values from raster intersecting a polygon</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hello list,<BR>
<BR>
I have to get values from raster where they intersect polygons from a layer with numerous polygons which have shared boundaries, but I don’t want to have duplicate values from raster. The final result must be something like : gid | val.<BR>
<BR>
To explain my case, I made a picture.<BR>
<BR>
I think ST_intersection could help but I don’t know what will be the exact result. In my example, we have a grid (a DEM for example), each red point is the value in the centre of each cell and two polygons A and B. I think cells totally within polygons are not a problem, but in green I have highlighted some ambiguous cases :<BR>
- 1 and 2 are cells shared by both polygons but not in the same proportions and I would like to get value 1 for polygon A but not for B and value 2 for polygon B but not for A<BR>
- What will be the result for cell number 3 and for the other green cell without number (and for all the ones which are not totally within a polygon) ? I think the value is the same for the whole cell (st_dumpaspolygon) and will be returned whatever the part of the cell covered by the polygon, but if someone could confirm.<BR>
<BR>
If st_intersection use st_DumpAsPolygon, could it be better to work directly with this polygonized table using its own gist index and dealing with shared areas of cells between different polygons ?<BR>
<BR>
Hugues.<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>