[Gdal-dev] OGR C API question

Frank Warmerdam warmerdam at pobox.com
Mon Mar 22 09:53:21 EST 2004


Markus Neteler wrote:
> 	poSpatialFilter = OGR_G_CreateGeometry( wkbPolygon );
> 	Ogr_oRing = OGR_G_CreateGeometry( wkbLineString );
>         OGR_G_AddPoint(Ogr_oRing, xmin, ymin, 0);
>         OGR_G_AddPoint(Ogr_oRing, xmin, ymax, 0);
>         OGR_G_AddPoint(Ogr_oRing, xmax, ymax, 0);
>         OGR_G_AddPoint(Ogr_oRing, xmax, ymin, 0);
>         OGR_G_AddPoint(Ogr_oRing, xmin, ymin, 0);
>         OGR_G_AddGeometryDirectly(poSpatialFilter, Ogr_oRing);
> 	
>         OGR_L_SetSpatialFilter(Ogr_layer, poSpatialFilter );
> 
> Does anyone see why this doesn't work any longer? The spatial filter is
> simply ignored.

Markus,

The wkbLineString should be wkbLinearRing. It looks like the
AddGeometryDirectly() method returns OGRERR_UNSUPPORTED_GEOMETRY_TYPE if
you pass anything other than a wkbLinearRing to add to a polygon.   The
checking may have been added after the initial implementation though I see
nothing obvious in the change logs.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list