[Gdal-dev] How to Create a Geometry Filter

Christopher Schmidt crschmidt at metacarta.com
Wed Oct 10 17:23:36 EDT 2007


On Wed, Oct 10, 2007 at 05:03:12PM -0400, Kent Eschenberg wrote:
> Greetings,
> 
> This is a combination complaint/question. I'm trying to use the layer 
> classes' geometry filter to select only features in an area bounded by 4 
>  points.
> 
> I can't do that directly but must use SetSpatialFilter and first create an 
> instance of OGRPolygon. I do so and look for a way to set the polygon's 
> points.

One thing you might do instead is use CreateGeometryFromWKT. In Python,
this is: 

ogr.CreateGeometryFromWkt("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))")

to create a polygon in the first unit of the first quadrant. 

I don't know exactly how this translates into C, but this returns a
wkbPolygon geometry type in Python.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Gdal-dev mailing list