diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 7b6a9658a468..065a6548783a 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -1036,7 +1036,7 @@ QgsFields QgsWFSProvider::fields() const return mShared->mFields; } -QString QgsWFSProvider::geometryAttribute() const +QString QgsWFSProvider::geometryColumnName() const { return mShared->mGeometryAttribute; } diff --git a/src/providers/wfs/qgswfsprovider.h b/src/providers/wfs/qgswfsprovider.h index 5040d099e9e3..890a9ea931c3 100644 --- a/src/providers/wfs/qgswfsprovider.h +++ b/src/providers/wfs/qgswfsprovider.h @@ -79,6 +79,7 @@ class QgsWFSProvider final : public QgsVectorDataProvider Qgis::WkbType wkbType() const override; long long featureCount() const override; + QString geometryColumnName() const override; QgsFields fields() const override; QgsCoordinateReferenceSystem crs() const override; @@ -104,8 +105,6 @@ class QgsWFSProvider final : public QgsVectorDataProvider /* new functions */ - QString geometryAttribute() const; - const QString processSQLErrorMsg() const { return mProcessSQLErrorMsg; } const QString processSQLWarningMsg() const { return mProcessSQLWarningMsg; } diff --git a/src/providers/wfs/qgswfsprovidermetadata.cpp b/src/providers/wfs/qgswfsprovidermetadata.cpp index 3a9ffab19c7c..0fff636863f8 100644 --- a/src/providers/wfs/qgswfsprovidermetadata.cpp +++ b/src/providers/wfs/qgswfsprovidermetadata.cpp @@ -297,11 +297,11 @@ QList QgsWfsProviderMetadata::querySublayers( const const QString &function = filterNames[i]; if ( function == QLatin1String( "IsNull" ) ) { - filter = QgsWFSProvider::buildIsNullGeometryFilter( caps, provider.geometryAttribute() ); + filter = QgsWFSProvider::buildIsNullGeometryFilter( caps, provider.geometryColumnName() ); } else if ( !function.isEmpty() ) { - filter = QgsWFSProvider::buildFilterByGeometryType( caps, provider.geometryAttribute(), function ); + filter = QgsWFSProvider::buildFilterByGeometryType( caps, provider.geometryColumnName(), function ); } if ( !provider.sharedData()->WFSFilter().isEmpty() ) diff --git a/src/providers/wfs/qgswfssubsetstringeditor.cpp b/src/providers/wfs/qgswfssubsetstringeditor.cpp index 8816ac862f4d..9732530aad34 100644 --- a/src/providers/wfs/qgswfssubsetstringeditor.cpp +++ b/src/providers/wfs/qgswfssubsetstringeditor.cpp @@ -116,9 +116,9 @@ QgsSubsetStringEditorInterface *QgsWfsSubsetStringEditor::create( QgsVectorLayer QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( field.name() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, field.typeName() ); } - if ( !provider->geometryAttribute().isEmpty() ) + if ( !provider->geometryColumnName().isEmpty() ) { - QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( provider->geometryAttribute() ) ); + QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( provider->geometryColumnName() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, QStringLiteral( "geometry" ) ); } fieldList << QgsSQLComposerDialog::PairNameType( fieldNamePrefix + "*", QString() ); @@ -189,9 +189,9 @@ void QgsWFSTableSelectedCallback::tableSelected( const QString &name ) QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( field.name() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, field.typeName() ); } - if ( !p.geometryAttribute().isEmpty() ) + if ( !p.geometryColumnName().isEmpty() ) { - QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( p.geometryAttribute() ) ); + QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( p.geometryColumnName() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, QStringLiteral( "geometry" ) ); } fieldList << QgsSQLComposerDialog::PairNameType( fieldNamePrefix + "*", QString() ); diff --git a/tests/src/python/test_provider_wfs.py b/tests/src/python/test_provider_wfs.py index bc385e4f3880..2bec071435cf 100644 --- a/tests/src/python/test_provider_wfs.py +++ b/tests/src/python/test_provider_wfs.py @@ -695,6 +695,7 @@ def testWFS10(self): ) self.assertTrue(vl.isValid()) self.assertEqual(vl.wkbType(), QgsWkbTypes.Type.Point) + self.assertEqual(vl.dataProvider().geometryColumnName(), "geometry") self.assertEqual(len(vl.fields()), 5) self.assertEqual(vl.featureCount(), 0) reference = QgsGeometry.fromRect(