Skip to content

Commit

Permalink
Merge pull request #60191 from rouault/fix_60055
Browse files Browse the repository at this point in the history
WFS provider: implement geometryColumnName()
  • Loading branch information
elpaso authored Jan 21, 2025
2 parents 597b746 + 8382e45 commit f0d3ce8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ QgsFields QgsWFSProvider::fields() const
return mShared->mFields;
}

QString QgsWFSProvider::geometryAttribute() const
QString QgsWFSProvider::geometryColumnName() const
{
return mShared->mGeometryAttribute;
}
Expand Down
3 changes: 1 addition & 2 deletions src/providers/wfs/qgswfsprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions src/providers/wfs/qgswfsprovidermetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ QList<QgsProviderSublayerDetails> 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() )
Expand Down
8 changes: 4 additions & 4 deletions src/providers/wfs/qgswfssubsetstringeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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() );
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_provider_wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f0d3ce8

Please sign in to comment.