Hi,<br><br>I'm using Gdal 1.9.<br><br>I have a function that has to perform a intersection of a geometry based on the click that is made on the screen. <br><br>The raster file (Geotiff) that has a projected reference system (WGS 84 / UTM zone 21S) and the geometry a georeferenced system (EPSG - 4326 WGS84). <br>
<br>The click that comes from the screen (spatial reference of the image) create a geometry from calling point.Buffer (radius).<br><br>When i want to verify that the geometries intersect the intersects method from OGRGeometry fails, even if the querypoint is transformed into the spatial reference system of the geometry.<br>
<br>Envelopes from the 2 geometries. <br>QueryPoint <br>env. <br>if i generates the querypoint from the spatial reference of the geometry that i want to intersect)<br>minx -61.66, maxx -53.66;<br>miny -41.97, maxy -33.97<br>
else<br>minx 443322.50, maxx 443330.50<br>miny 5798153.59, maxy 5798161.59<br><br>
Geometry env.<br>minx -57.79, maxx -57.59;<br>miny -38.08, maxy-37.92<br><br><br>The code is something like this:<br><br>// spatialfilterwindow image subset transformed into <br>// the spatial reference of the vector to intersect<br>
Extent spatialfilter(spatialfilterwindow);<br>player->SetSpatialFilterRect(spatialfilter.min_.x_,<br> spatialfilter.min_.y_,<br> spatialfilter.max_.x_,<br> spatialfilter.max_.y_);<br>
OGRLayer* player = ...;<br>OGRFeature *pfeature = player->GetNextFeature(); <br>OGRPoint querypoint = OGRPoint(Point.x_, Point.y_);<br>querypoint.assignSpatialReference(new OGRSpatialReference(SrWkt.c_str()));<br>OGRGeometry* pquerypoly = querypoint.Buffer(radius);<br>
<b>while </b>(pfeature) {<br> OGRGeometry *pgeometry = pfeature->GetGeometryRef();<br> <b>if </b>((pgeometry && pgeometry->Intersects(pquerypoly) == TRUE)<br> || (pquerypoly && pquerypoly->Intersects(pgeometry) == TRUE)) {<br>
// do something...<br> } <b>else </b>{<br> // handle the intersection fail<br> }<br> pfeature = player->GetNextFeature();<br>}<br><br>Any idea why it fails?<br><br clear="all">Thanks,<br>Regards,<br>
<br>-- <br><span><font color="#888888">Gabriel Fusca<br>
SUR Emprendimientos Tecnológicos<br>
<br>Perú 345 Piso 5to Oficina "B" (C1067AAG)<br>Ciudad de Buenos Aires, Argentina<br>Tel. +54 (11) 4342-2976/84<br><a href="mailto:gabrielfusca@suremptec.com.ar" target="_blank">gabrielfusca@suremptec.com.ar</a><br>
<a href="http://www.suremptec.com/" target="_blank">http://www.suremptec.com/</a><br></font></span><br>