[gdal-dev] OGR error handling

Even Rouault even.rouault at spatialys.com
Tue Oct 20 12:58:37 PDT 2015


André,

> Hi all,
> 
> We are using OGRSFDriver::CopyDataSource() to copy a GML data source to a
> memory data source on v1.11.x.
> 
> We have encountered a problem where one of the feature tags of a particular
> GML file we are trying to read is malformed. What we are seeing is that an
> error occurs in OGRGMLLayer::GetNextFeature(), which gets reported as
> expected via CPLError().
> 
> The problem we are faced with is that that error seems to be reset using
> CPLErrorReset() before control returns to the caller of CopyDataSource(),
> specifically in OGRDataSource::CopyLayer(). The result is that the copying
> silently skips over problematic features.

I'm not clear of the reason for those CPLErrorReset() in CopyLayer(). I guess 
you could remove them without trouble.

If you don't want to modify GDAL sources, a workaround would be to install 
your own error handler with CPLSetErrorHandler() or CPLPushErrorHandler() so 
as to note the error.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list