[gdal-dev] How to identify a point is belong to a polygon ?

taibc taibc_coltech at yahoo.com
Fri Jul 20 23:49:29 PDT 2012


Hi Chaitanya,

I still can't run the method "Geometry::Within". And I got the error: "GEOS
support not enable" when trying use this method.

Please find the attached file for sample code.
http://osgeo-org.1560.n6.nabble.com/file/n4989766/Source1.cpp Source1.cpp 

About spatial filter, you said that: we can use the spatial filter of the
ogr layer to filter the point features. But, I think it is used to filter
features that geometrically intersect the filter geometry.

For example: if I have one polygon A feature, I can use the method
"SetSpatialFilter" to get other features (Point or Polygon) that
geometrically *intersect* with A.



chaitanya_ch wrote
> 
> Tai,
> 
> You can use the spatial filter of the ogr layer to filter the point
> features to speed things up. You will still have to test if the point is
> within the polygon but it will be faster.
> 
> Also, make sure the test is like point->Within(polygon) and not
> polygon->Within(point)
> 
> OGRLayer::SetSpatialFilter()
> http://www.gdal.org/ogr/classOGRLayer.html#a0b4ab45cf97cbc470f0d60474d3e4169
> 
> On Fri, Jul 20, 2012 at 9:29 AM, Bui Chi Tai <taibc_coltech@>wrote:
> 
> 




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-identify-a-point-is-belong-to-a-polygon-tp4989501p4989766.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list