diff --git a/python/gui/auto_generated/qgsnewhttpconnection.sip.in b/python/gui/auto_generated/qgsnewhttpconnection.sip.in index e478fd34dc7..0f27c1b3949 100644 --- a/python/gui/auto_generated/qgsnewhttpconnection.sip.in +++ b/python/gui/auto_generated/qgsnewhttpconnection.sip.in @@ -108,6 +108,7 @@ Returns the "test connection" button. + virtual QString wfsSettingsKey( const QString &base, const QString &connectionName ) const; %Docstring Returns the QSettings key for WFS related settings for the connection. diff --git a/src/gui/qgsnewhttpconnection.cpp b/src/gui/qgsnewhttpconnection.cpp index 3e1eb2d1c5c..fcdc8c9a51d 100644 --- a/src/gui/qgsnewhttpconnection.cpp +++ b/src/gui/qgsnewhttpconnection.cpp @@ -166,6 +166,7 @@ void QgsNewHttpConnection::wfsVersionCurrentIndexChanged( int index ) txtPageSize->setEnabled( cbxWfsFeaturePaging->isChecked() && ( index == WFS_VERSION_MAX || index >= WFS_VERSION_1_1 ) ); cbxWfsIgnoreAxisOrientation->setEnabled( index != WFS_VERSION_1_0 && index != WFS_VERSION_API_FEATURES_1_0 ); cbxWfsInvertAxisOrientation->setEnabled( index != WFS_VERSION_API_FEATURES_1_0 ); + wfsUseGml2EncodingForTransactions()->setEnabled( index == WFS_VERSION_1_1 ); } void QgsNewHttpConnection::wfsFeaturePagingStateChanged( int state ) @@ -256,6 +257,11 @@ QCheckBox *QgsNewHttpConnection::wfsPagingEnabledCheckBox() return cbxWfsFeaturePaging; } +QCheckBox *QgsNewHttpConnection::wfsUseGml2EncodingForTransactions() +{ + return cbxWfsUseGml2EncodingForTransactions; +} + QLineEdit *QgsNewHttpConnection::wfsPageSizeLineEdit() { return txtPageSize; @@ -281,6 +287,8 @@ void QgsNewHttpConnection::updateServiceSpecificSettings() cbxWmsIgnoreReportedLayerExtents->setChecked( settings.value( wmsKey + QStringLiteral( "/ignoreReportedLayerExtents" ), false ).toBool() ); cbxWfsIgnoreAxisOrientation->setChecked( settings.value( wfsKey + "/ignoreAxisOrientation", false ).toBool() ); cbxWfsInvertAxisOrientation->setChecked( settings.value( wfsKey + "/invertAxisOrientation", false ).toBool() ); + cbxWfsUseGml2EncodingForTransactions->setChecked( settings.value( wfsKey + "/preferCoordinatesForWfsT11", false ).toBool() ); + cbxWmsIgnoreAxisOrientation->setChecked( settings.value( wmsKey + "/ignoreAxisOrientation", false ).toBool() ); cbxWmsInvertAxisOrientation->setChecked( settings.value( wmsKey + "/invertAxisOrientation", false ).toBool() ); cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( wmsKey + "/ignoreGetFeatureInfoURI", false ).toBool() ); @@ -463,6 +471,7 @@ void QgsNewHttpConnection::accept() { settings.setValue( wfsKey + "/ignoreAxisOrientation", cbxWfsIgnoreAxisOrientation->isChecked() ); settings.setValue( wfsKey + "/invertAxisOrientation", cbxWfsInvertAxisOrientation->isChecked() ); + settings.setValue( wfsKey + "/preferCoordinatesForWfsT11", cbxWfsUseGml2EncodingForTransactions->isChecked() ); } if ( mTypes & ConnectionWms || mTypes & ConnectionWcs ) { diff --git a/src/gui/qgsnewhttpconnection.h b/src/gui/qgsnewhttpconnection.h index 1978fb19fb5..5a5860d2f4f 100644 --- a/src/gui/qgsnewhttpconnection.h +++ b/src/gui/qgsnewhttpconnection.h @@ -150,6 +150,12 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo */ QCheckBox *wfsPagingEnabledCheckBox() SIP_SKIP; + /** + * Returns the "Use GML2 encoding for transactions" checkbox + * \since QGIS 3.16 + */ + QCheckBox *wfsUseGml2EncodingForTransactions() SIP_SKIP; + /** * Returns the "WFS page size" edit * \since QGIS 3.2 diff --git a/src/providers/wfs/qgswfsconnection.cpp b/src/providers/wfs/qgswfsconnection.cpp index 4e28fd4aa44..fb2c61f391a 100644 --- a/src/providers/wfs/qgswfsconnection.cpp +++ b/src/providers/wfs/qgswfsconnection.cpp @@ -53,6 +53,13 @@ QgsWfsConnection::QgsWfsConnection( const QString &connName ) settings.value( key + "/" + QgsWFSConstants::SETTINGS_PAGING_ENABLED, true ).toBool() ? QStringLiteral( "true" ) : QStringLiteral( "false" ) ); } + if ( settings.contains( key + "/" + QgsWFSConstants::SETTINGS_WFST_1_1_PREFER_COORDINATES ) ) + { + mUri.removeParam( QgsWFSConstants::URI_PARAM_WFST_1_1_PREFER_COORDINATES ); // setParam allow for duplicates! + mUri.setParam( QgsWFSConstants::URI_PARAM_WFST_1_1_PREFER_COORDINATES, + settings.value( key + "/" + QgsWFSConstants::SETTINGS_WFST_1_1_PREFER_COORDINATES, true ).toBool() ? QStringLiteral( "true" ) : QStringLiteral( "false" ) ); + } + QgsDebugMsgLevel( QStringLiteral( "WFS full uri: '%1'." ).arg( QString( mUri.uri() ) ), 4 ); } diff --git a/src/providers/wfs/qgswfsconstants.cpp b/src/providers/wfs/qgswfsconstants.cpp index 2f2067acbfd..9bb7beb5b8b 100644 --- a/src/providers/wfs/qgswfsconstants.cpp +++ b/src/providers/wfs/qgswfsconstants.cpp @@ -40,6 +40,7 @@ const QString QgsWFSConstants::URI_PARAM_VALIDATESQLFUNCTIONS( QStringLiteral( " const QString QgsWFSConstants::URI_PARAM_HIDEDOWNLOADPROGRESSDIALOG( QStringLiteral( "hideDownloadProgressDialog" ) ); const QString QgsWFSConstants::URI_PARAM_PAGING_ENABLED( "pagingEnabled" ); const QString QgsWFSConstants::URI_PARAM_PAGE_SIZE( "pageSize" ); +const QString QgsWFSConstants::URI_PARAM_WFST_1_1_PREFER_COORDINATES( "preferCoordinatesForWfsT11" ); const QString QgsWFSConstants::VERSION_AUTO( QStringLiteral( "auto" ) ); @@ -48,3 +49,4 @@ const QString QgsWFSConstants::SETTINGS_VERSION( QStringLiteral( "version" ) ); const QString QgsWFSConstants::SETTINGS_MAXNUMFEATURES( QStringLiteral( "maxnumfeatures" ) ); const QString QgsWFSConstants::SETTINGS_PAGING_ENABLED( QStringLiteral( "pagingenabled" ) ); const QString QgsWFSConstants::SETTINGS_PAGE_SIZE( QStringLiteral( "pagesize" ) ); +const QString QgsWFSConstants::SETTINGS_WFST_1_1_PREFER_COORDINATES( QStringLiteral( "preferCoordinatesForWfsT11" ) ); diff --git a/src/providers/wfs/qgswfsconstants.h b/src/providers/wfs/qgswfsconstants.h index e1926f725f6..4a13d78c97d 100644 --- a/src/providers/wfs/qgswfsconstants.h +++ b/src/providers/wfs/qgswfsconstants.h @@ -48,6 +48,7 @@ struct QgsWFSConstants static const QString URI_PARAM_HIDEDOWNLOADPROGRESSDIALOG; static const QString URI_PARAM_PAGING_ENABLED; static const QString URI_PARAM_PAGE_SIZE; + static const QString URI_PARAM_WFST_1_1_PREFER_COORDINATES; // static const QString VERSION_AUTO; @@ -58,6 +59,7 @@ struct QgsWFSConstants static const QString SETTINGS_MAXNUMFEATURES; static const QString SETTINGS_PAGING_ENABLED; static const QString SETTINGS_PAGE_SIZE; + static const QString SETTINGS_WFST_1_1_PREFER_COORDINATES; }; #endif // QGSWFSCONSTANTS_H diff --git a/src/providers/wfs/qgswfsdatasourceuri.cpp b/src/providers/wfs/qgswfsdatasourceuri.cpp index dc37ace522c..4f56098988c 100644 --- a/src/providers/wfs/qgswfsdatasourceuri.cpp +++ b/src/providers/wfs/qgswfsdatasourceuri.cpp @@ -373,6 +373,12 @@ bool QgsWFSDataSourceURI::hideDownloadProgressDialog() const return mURI.hasParam( QgsWFSConstants::URI_PARAM_HIDEDOWNLOADPROGRESSDIALOG ); } + +bool QgsWFSDataSourceURI::preferCoordinatesForWfst11() const +{ + return mURI.hasParam( QgsWFSConstants::URI_PARAM_WFST_1_1_PREFER_COORDINATES ); +} + QString QgsWFSDataSourceURI::build( const QString &baseUri, const QString &typeName, const QString &crsString, diff --git a/src/providers/wfs/qgswfsdatasourceuri.h b/src/providers/wfs/qgswfsdatasourceuri.h index 2ccaefbd7ba..e3e09023ae3 100644 --- a/src/providers/wfs/qgswfsdatasourceuri.h +++ b/src/providers/wfs/qgswfsdatasourceuri.h @@ -113,6 +113,9 @@ class QgsWFSDataSourceURI //! Whether to hide download progress dialog in QGIS main app. Defaults to false bool hideDownloadProgressDialog() const; + //! Whether to use "ccordinates" instead of "pos" and "posList" for WFS-T 1.1 transactions (ESRI mapserver) + bool preferCoordinatesForWfst11() const; + //! Returns authorization parameters const QgsAuthorizationSettings &auth() const { return mAuth; } diff --git a/src/providers/wfs/qgswfsshareddata.h b/src/providers/wfs/qgswfsshareddata.h index 5ecc1293d0a..2a0f61e61ad 100644 --- a/src/providers/wfs/qgswfsshareddata.h +++ b/src/providers/wfs/qgswfsshareddata.h @@ -90,7 +90,7 @@ class QgsWFSSharedData : public QObject, public QgsBackgroundCachedSharedData bool mGetFeatureEPSGDotHonoursEPSGOrder = false; /** - * Server (typically ESRI) does not like pos and posList, and wants "coordinates" for WFS 1.1 transactions + * If the server (typically ESRI with WFS-T 1.1 in 2020) does not like "pos" and "posList", and requires "coordinates" for WFS 1.1 transactions */ bool mServerPrefersCoordinatesForTransactions_1_1 = false; diff --git a/src/ui/qgsnewhttpconnectionbase.ui b/src/ui/qgsnewhttpconnectionbase.ui index b5717dec65c..0b0f5e229d2 100644 --- a/src/ui/qgsnewhttpconnectionbase.ui +++ b/src/ui/qgsnewhttpconnectionbase.ui @@ -7,7 +7,7 @@ 0 0 448 - 761 + 815 @@ -173,9 +173,6 @@ - - - @@ -183,42 +180,45 @@ - - - - Max. number of features - - - - - - - <html><head/><body><p>Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.</p></body></html> - - - - - - - Page size - - - - - - - <html><head/><body><p>Enter a number to limit the maximum number of features retrieved in a single GetFeature request when paging is enabled. If let to empty, server default will apply.</p></body></html> - - - - + Ignore axis orientation (WFS 1.1/WFS 2.0) - + + + + Max. number of features + + + + + + + + + + <html><head/><body><p>Enter a number to limit the maximum number of features retrieved in a single GetFeature request when paging is enabled. If let to empty, server default will apply.</p></body></html> + + + + + + + Invert axis orientation + + + + + + + Page size + + + + Enable feature paging @@ -228,10 +228,20 @@ - - + + + + <html><head/><body><p>Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.</p></body></html> + + + + + + + <html><head/><body><p>This might be necessary on some <span style=" font-weight:600;">broken</span> ESRI map servers when using WFS-T 1.1.0.</p></body></html> + - Invert axis orientation + Use GML2 encoding for transactions