[gdal-dev] New OGR_GEOM_AREA special field

Daniel Morissette dmorissette at mapgears.com
Wed Apr 15 16:34:35 EDT 2009


Hi GDAL Dev's,

I'd like to use a OGR SQL statement to filter features from a shapefile 
based on their area. e.g. keep only the large lakes in a water layer for 
instance.

A simple way to allow this would be to add a new OGR_GEOM_AREA special 
field on OGRFeatures that calls the OGRSurface::getArea() method and 
would be handled similar to the OGR_GEOM_WKT and other special fields in 
OGRFeature::GetFieldAsString?().

Another option could be to add operators on geometries in the SQL parser 
but that could be a bit more involved (e.g. "select ST_Area(geom) from 
...").

I have created a ticket about this which includes a patch for the new 
OGR_GEOM_AREA special field:

http://trac.osgeo.org/gdal/ticket/2949

What would you think of adding this to the SVN trunk? Or can anyone 
provide hints on the way to implement operators on geometries since that 
would clearly be a better solution but I'm not clear on the best way to 
add this to the OGR SQL engine.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/


More information about the gdal-dev mailing list