Skip to content

Commit

Permalink
Add option for ServerPrefersCoordinatesForTransactions_1_1
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 15, 2020
1 parent f29f86f commit 9c0a620
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 26 deletions.
1 change: 1 addition & 0 deletions python/gui/auto_generated/qgsnewhttpconnection.sip.in
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -256,6 +257,11 @@ QCheckBox *QgsNewHttpConnection::wfsPagingEnabledCheckBox()
return cbxWfsFeaturePaging;
}

QCheckBox *QgsNewHttpConnection::wfsUseGml2EncodingForTransactions()
{
return cbxWfsUseGml2EncodingForTransactions;
}

QLineEdit *QgsNewHttpConnection::wfsPageSizeLineEdit()
{
return txtPageSize;
Expand All @@ -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() );
Expand Down Expand Up @@ -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 )
{
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsnewhttpconnection.h
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/providers/wfs/qgswfsconnection.cpp
Expand Up @@ -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 );
}

Expand Down
2 changes: 2 additions & 0 deletions src/providers/wfs/qgswfsconstants.cpp
Expand Up @@ -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" ) );

Expand All @@ -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" ) );
2 changes: 2 additions & 0 deletions src/providers/wfs/qgswfsconstants.h
Expand Up @@ -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;
Expand All @@ -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
6 changes: 6 additions & 0 deletions src/providers/wfs/qgswfsdatasourceuri.cpp
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/providers/wfs/qgswfsdatasourceuri.h
Expand Up @@ -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; }

Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsshareddata.h
Expand Up @@ -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;

Expand Down
60 changes: 35 additions & 25 deletions src/ui/qgsnewhttpconnectionbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>448</width>
<height>761</height>
<height>815</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -173,52 +173,52 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cmbVersion"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="mWfsVersionDetectButton">
<property name="text">
<string>Detect</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblMaxNumFeatures">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsIgnoreAxisOrientation">
<property name="text">
<string>Max. number of features</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="txtMaxNumFeatures">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Ignore axis orientation (WFS 1.1/WFS 2.0)</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblPageSize">
<item row="2" column="0">
<widget class="QLabel" name="lblMaxNumFeatures">
<property name="text">
<string>Page size</string>
<string>Max. number of features</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<item row="0" column="1">
<widget class="QComboBox" name="cmbVersion"/>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="txtPageSize">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsIgnoreAxisOrientation">
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsInvertAxisOrientation">
<property name="text">
<string>Ignore axis orientation (WFS 1.1/WFS 2.0)</string>
<string>Invert axis orientation</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="4" column="0">
<widget class="QLabel" name="lblPageSize">
<property name="text">
<string>Page size</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsFeaturePaging">
<property name="text">
<string>Enable feature paging</string>
Expand All @@ -228,10 +228,20 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsInvertAxisOrientation">
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="txtMaxNumFeatures">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWfsUseGml2EncodingForTransactions">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This might be necessary on some &lt;span style=&quot; font-weight:600;&quot;&gt;broken&lt;/span&gt; ESRI map servers when using WFS-T 1.1.0.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Invert axis orientation</string>
<string>Use GML2 encoding for transactions</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 9c0a620

Please sign in to comment.