[Gdal-dev] OGRDataSource::ExecuteSQL() method returning inaccurate results

Frank Warmerdam warmerdam at pobox.com
Wed May 12 13:02:38 EDT 2004


Chapman, Martin wrote:
> Frank,
> 
> Thanks for the quick answer.  I just replied to my own question saying
> that I found the error.  It was in my code (as usual).  I was passing in
> the x,y points as y,x... so the filter does work.  You are correct that
> the orange box is my aoi rectangle.  
> 
> I did notice what you mentioned below about using the MBR of the
> feature.  I know how to write the intersection functions needed to
> filter n-gons, do you think it would be difficult to modify the
> ExecuteSQL to use the geometry instead of the MBR for the filtering?  If
> you don't think that would be hard, what source code file would I make
> the mod in?  Or, has someone done that already?

Martin,

I think the thing to do would be to implement the OGRGeometry::Intersect()
method properly.  But note that this implies being able to handle any two
geometry types not just polygons against polygon.

Also, if you do this, please ensure that the MBR pre-test is kept in place
to quickly handle some cases.  In fact, a special case for testing against
a rectangular polygon would also likely be worthwhile.

The current OGRGeometry::Intersect() implementation is in
gdal/ogr/ogrgeometry.cpp.

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