[gdal-dev] Accuracy of OGRLayer:SetSpatialFilter() API

kedardeshpande87 kedardeshpande87 at gmail.com
Tue Jun 12 16:35:55 PDT 2012


Thanks dbnakuru,

quote author="dbnakuru">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
Otherwise what you can do is test to see if your point is in any of the
polygons returned by OGR.  So let OGR do the initial checks then grab
the vertices yourself and run a point in polygon test.  There are
multiple examples of the crossings test available on the web search for
code point in polygon to see a bunch in google.  Just pick the one
that's appropriate for whatever language you're using. 


I am writing the application in Java using the Java bindings. Thus, as you
suggested, for the inputs for which I get multiple features, for each
feature, I will run the point-in-polygon test by retrieving all its ring
points and checking the input point if it falls inside the polygon ring of
the feature. For this, I am trying to call
feature.GetGeometryRef().getPoints(). This method is returning me null.
Also, getPointCount() is returning me 0.
When I write the same thing in C++, by doing : 

OGRGeometry *geom = feature->GetGeometryRef();
OGRLinearRing *extRing = ((OGRPolygon *) geom)->getExteriorRing();
// ....extRing->getNumPoints() ... etc
This returns me valid number of points and their coordinates.
In Java, there is no explicit api for different geometry types. How do I
achieve this using the Java api ?

Am I going in the right direction to achieve this?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-Accuracy-of-OGRLayer-SetSpatialFilter-API-tp4980063p4980987.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list