[Gdal-dev] OGR C API question
    Markus Neteler 
    neteler at itc.it
       
    Mon Mar 22 09:21:26 EST 2004
    
    
  
Dear list members,
inspired by
 gdal/ogr/ogr_capi_test.c
I had implemented a spatial filter in v.in.ogr (GRASS 5.7).
This was functional last year, but testing it with the current
GDAL-CVS, it doesn't work any longer. It always imports the
full map.
Code snippet below, if needed, the full C code is here:
http://freegis.org/cgi-bin/viewcvs.cgi/grass51/vector/v.in.ogr/main.c?rev=1.31&content-type=text/vnd.viewcvs-markup
The variables xmin, ymin, xmax, ymax are defined (checked with
debug output).
[... main.c ...]
        OGRGeometryH Ogr_oRing=NULL, poSpatialFilter=NULL;
[...]
    if ( spat_opt->answer ) {
[...]
        G_debug( 2, "cut out with boundaries: %f %f %f %f",xmin,ymin,xmax,ymax);
	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.
Thanks in advance
 Markus
    
    
More information about the Gdal-dev
mailing list