[gdal-dev] spatial filter problem

Even Rouault even.rouault at mines-paris.org
Fri Feb 10 12:24:28 EST 2012


Selon Mohammed Rashad <mohammedrashadkm at gmail.com>:

>   OGRLinearRing oSpatialFilter;
>
>   oSpatialFilter.setNumPoints(5);
>   oSpatialFilter.setPoint(0, rect.minx, rect.miny);
>   oSpatialFilter.setPoint(1, rect.maxx, rect.miny);
>   oSpatialFilter.setPoint(2, rect.maxx, rect.maxy);
>   oSpatialFilter.setPoint(3, rect.minx, rect.maxy);
>   oSpatialFilter.setPoint(4, rect.minx, rect.miny);
>
>  poLayer->SetSpatialFilter( &oSpatialFilter );
>   poLayer->ResetReading();
>
>
> poFeature = poLayer->GetNextFeature() gives me null poFeature
>
> does spatialFilter requires gdal build with geos?
>
> with 1.8.0 ubuntu version I am able to use spatialFilter but not with trunk

Hum, I'm skeptical that directly feeding a OGRLinearRing has ever worked. You
should try instead to add it to a OGRPolygon, and then pass the polygon as the
spatial filter.

GEOS isn't strictly required for spatial filter to work. If it is available,
genuine interesection tests will be made when necessary. If not available, only
tests based on bounding box comparison will be made.

>
> --
> Regards,
>    Rashad
>




More information about the gdal-dev mailing list