Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFS provider: implement geometryColumnName() #60191

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading