From 2502a3376ee2de7f8cc5e6fd08a9f4b82beb1c2a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 4 Jun 2018 15:05:51 +0200 Subject: [PATCH] [OGR provider] Custom GPKG implementation of GetExtent() only needed for GDAL < 2.4 --- src/providers/ogr/qgsogrprovider.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index df38a40eed4..6bbe3e42a79 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -5229,6 +5229,7 @@ GIntBig QgsOgrLayer::GetApproxFeatureCount() return OGR_L_GetFeatureCount( hLayer, TRUE ); } +#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,4,0) static bool findMinOrMax( GDALDatasetH hDS, const QByteArray &rtreeName, const char *varName, bool isMin, double &val ) { @@ -5276,11 +5277,13 @@ static bool findMinOrMax( GDALDatasetH hDS, const QByteArray &rtreeName, } return true; } +#endif OGRErr QgsOgrLayer::GetExtent( OGREnvelope *psExtent, bool bForce ) { QMutexLocker locker( &ds->mutex ); +#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,4,0) // OGR_L_GetExtent() can be super slow on huge geopackage files // so implement some approximation strategy that has reasonable runtime. // Actually this should return a rather accurante answer. @@ -5323,6 +5326,8 @@ OGRErr QgsOgrLayer::GetExtent( OGREnvelope *psExtent, bool bForce ) return OGRERR_NONE; } } +#endif + return OGR_L_GetExtent( hLayer, psExtent, bForce ); }