Skip to content

Commit

Permalink
[OGR provider] Custom GPKG implementation of GetExtent() only needed …
Browse files Browse the repository at this point in the history
…for GDAL < 2.4
  • Loading branch information
rouault committed Jun 4, 2018
1 parent 4f53135 commit 2502a33
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -5323,6 +5326,8 @@ OGRErr QgsOgrLayer::GetExtent( OGREnvelope *psExtent, bool bForce )
return OGRERR_NONE;
}
}
#endif

return OGR_L_GetExtent( hLayer, psExtent, bForce );
}

Expand Down

0 comments on commit 2502a33

Please sign in to comment.