Skip to content

Commit

Permalink
HANA: Don't limit FilterRect to SRS bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
mrylov authored and nyalldawson committed Jan 18, 2023
1 parent 39d7f48 commit f286225
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/providers/hana/qgshanafeatureiterator.cpp
Expand Up @@ -309,8 +309,6 @@ QString QgsHanaFeatureIterator::buildSqlQuery( const QgsFeatureRequest &request
bool limitAtProvider = ( request.limit() >= 0 ) && mRequest.spatialFilterType() != Qgis::SpatialFilterType::DistanceWithin;

QgsRectangle filterRect = mFilterRect;
if ( !mSource->mSrsExtent.isEmpty() )
filterRect = mSource->mSrsExtent.intersect( filterRect );

if ( !filterRect.isFinite() )
QgsMessageLog::logMessage( QObject::tr( "Infinite filter rectangle specified" ), QObject::tr( "SAP HANA" ) );
Expand Down Expand Up @@ -511,7 +509,6 @@ QgsHanaFeatureSource::QgsHanaFeatureSource( const QgsHanaProvider *p )
, mGeometryColumn( p->mGeometryColumn )
, mGeometryType( p->wkbType() )
, mSrid( p->mSrid )
, mSrsExtent( p->mSrsExtent )
, mCrs( p->crs() )
{
if ( p->mHasSrsPlanarEquivalent && p->mDatabaseVersion.majorVersion() <= 1 )
Expand Down
12 changes: 2 additions & 10 deletions src/providers/hana/qgshanaprovider.cpp
Expand Up @@ -1473,21 +1473,13 @@ void QgsHanaProvider::readSrsInformation( QgsHanaConnection &conn )
return;
}

QgsRectangle ext;
bool isRoundEarth = false;
QString sql = QStringLiteral( "SELECT MIN_X, MIN_Y, MAX_X, MAX_Y, ROUND_EARTH FROM SYS.ST_SPATIAL_REFERENCE_SYSTEMS "
QString sql = QStringLiteral( "SELECT ROUND_EARTH FROM SYS.ST_SPATIAL_REFERENCE_SYSTEMS "
"WHERE SRS_ID = ?" );
QgsHanaResultSetRef rs = conn.executeQuery( sql, { mSrid } );
if ( rs->next() )
{
ext.setXMinimum( rs->getDouble( 1 ) );
ext.setYMinimum( rs->getDouble( 2 ) );
ext.setXMaximum( rs->getDouble( 3 ) );
ext.setYMaximum( rs->getDouble( 4 ) );
isRoundEarth = ( rs->getString( 5 ) == QLatin1String( "TRUE" ) );
}
isRoundEarth = ( rs->getString( 1 ) == QLatin1String( "TRUE" ) );
rs->close();
mSrsExtent = ext;

if ( isRoundEarth )
{
Expand Down
2 changes: 0 additions & 2 deletions src/providers/hana/qgshanaprovider.h
Expand Up @@ -128,8 +128,6 @@ class QgsHanaProvider final : public QgsVectorDataProvider
QgsDataSourceUri mUri;
// Srid of the geometry column
int mSrid = -1;
// Srs extent
QgsRectangle mSrsExtent;
// Flag that shows the presence of a planar equivalent in a database
bool mHasSrsPlanarEquivalent = false;
// Name of the table with no schema
Expand Down

0 comments on commit f286225

Please sign in to comment.