Skip to content

Commit

Permalink
[OGR provider] Workaround bug in OGR GML driver
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Sep 15, 2017
1 parent c26584c commit 0ee9d66
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -3179,7 +3179,16 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
if ( hIdentifiedDriver &&
strcmp( GDALGetDriverShortName( hIdentifiedDriver ), "GML" ) == 0 )
{
papszOpenOptions = CSLSetNameValue( papszOpenOptions, "FORCE_SRS_DETECTION", "YES" );
// There's currently a bug in the OGR GML driver. If a .gfs file exists
// and FORCE_SRS_DETECTION is set, then OGR_L_GetFeatureCount() returns
// twice the number of features. And as, the .gfs contains the SRS, there
// is no need to turn this option on.
// https://trac.osgeo.org/gdal/ticket/7046
VSIStatBufL sStat;
if ( VSIStatL( CPLResetExtension( pszPath, "gfs" ), &sStat ) != 0 )
{
papszOpenOptions = CSLSetNameValue( papszOpenOptions, "FORCE_SRS_DETECTION", "YES" );
}
}

const int nOpenFlags = GDAL_OF_VECTOR | ( bUpdate ? GDAL_OF_UPDATE : 0 );
Expand Down

0 comments on commit 0ee9d66

Please sign in to comment.