Skip to content

Commit 0ee9d66

Browse files
committedSep 15, 2017
[OGR provider] Workaround bug in OGR GML driver
1 parent c26584c commit 0ee9d66

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3179,7 +3179,16 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
31793179
if ( hIdentifiedDriver &&
31803180
strcmp( GDALGetDriverShortName( hIdentifiedDriver ), "GML" ) == 0 )
31813181
{
3182-
papszOpenOptions = CSLSetNameValue( papszOpenOptions, "FORCE_SRS_DETECTION", "YES" );
3182+
// There's currently a bug in the OGR GML driver. If a .gfs file exists
3183+
// and FORCE_SRS_DETECTION is set, then OGR_L_GetFeatureCount() returns
3184+
// twice the number of features. And as, the .gfs contains the SRS, there
3185+
// is no need to turn this option on.
3186+
// https://trac.osgeo.org/gdal/ticket/7046
3187+
VSIStatBufL sStat;
3188+
if ( VSIStatL( CPLResetExtension( pszPath, "gfs" ), &sStat ) != 0 )
3189+
{
3190+
papszOpenOptions = CSLSetNameValue( papszOpenOptions, "FORCE_SRS_DETECTION", "YES" );
3191+
}
31833192
}
31843193

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

0 commit comments

Comments
 (0)
Please sign in to comment.