Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[WFS] Improve support of layers with unknown geometry type with Deegr…
…ee servers or any server implementing IsPoint, IsCurve and IsSurface filtering functions. When such a layer is added to the project, the Select Items to Add dialog box used for example for OGR vector layers with unknown geometry type is displayed, enabling the user to select one or several layers among ones of NoGeometry/MultiPoint/MultiCurve/MultiSurface/GeometryCollection types. Fixes #49328
- Loading branch information
Showing
17 changed files
with
1,352 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/*************************************************************************** | ||
qgswfsgetfeature.cpp | ||
--------------------- | ||
begin : November 2022 | ||
copyright : (C) 2022 by Even Rouault | ||
email : even.rouault at spatialys.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgswfsgetfeature.h" | ||
#include "qgsmessagelog.h" | ||
#include <QUrlQuery> | ||
|
||
QgsWFSGetFeature::QgsWFSGetFeature( QgsWFSDataSourceURI &uri ) | ||
: QgsWfsRequest( uri ) | ||
{ | ||
} | ||
|
||
bool QgsWFSGetFeature::request( bool synchronous, const QString &WFSVersion, | ||
const QString &typeName, const QString &filter, bool hitsOnly, const QgsWfsCapabilities::Capabilities &caps ) | ||
{ | ||
QUrl url( mUri.requestUrl( QStringLiteral( "GetFeature" ) ) ); | ||
QUrlQuery query( url ); | ||
query.addQueryItem( QStringLiteral( "VERSION" ), WFSVersion ); | ||
|
||
const QString namespaceValue( caps.getNamespaceParameterValue( WFSVersion, typeName ) ); | ||
|
||
if ( WFSVersion.startsWith( QLatin1String( "2.0" ) ) ) | ||
{ | ||
query.addQueryItem( QStringLiteral( "TYPENAMES" ), typeName ); | ||
if ( !namespaceValue.isEmpty() ) | ||
{ | ||
query.addQueryItem( QStringLiteral( "NAMESPACES" ), namespaceValue ); | ||
} | ||
} | ||
else | ||
{ | ||
query.addQueryItem( QStringLiteral( "TYPENAME" ), typeName ); | ||
} | ||
|
||
if ( !namespaceValue.isEmpty() ) | ||
{ | ||
query.addQueryItem( QStringLiteral( "NAMESPACE" ), namespaceValue ); | ||
} | ||
|
||
if ( !filter.isEmpty() ) | ||
{ | ||
query.addQueryItem( QStringLiteral( "FILTER" ), filter ); | ||
} | ||
|
||
if ( hitsOnly ) | ||
{ | ||
query.addQueryItem( QStringLiteral( "RESULTTYPE" ), "hits" ); | ||
} | ||
|
||
url.setQuery( query ); | ||
return sendGET( url, QString(), synchronous, /*forceRefresh=*/ true, /* cache=*/ false ); | ||
} | ||
|
||
QString QgsWFSGetFeature::errorMessageWithReason( const QString &reason ) | ||
{ | ||
return tr( "Download of feature type failed: %1" ).arg( reason ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
qgswfsgetfeature.h | ||
--------------------- | ||
begin : November 2022 | ||
copyright : (C) 2022 by Even Rouault | ||
email : even.rouault at spatialys.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSWFSGETFEATURE_H | ||
#define QGSWFSGETFEATURE_H | ||
|
||
#include "qgswfsrequest.h" | ||
#include "qgswfscapabilities.h" | ||
|
||
//! Manages the QgsWFSGetFeature request | ||
class QgsWFSGetFeature : public QgsWfsRequest | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit QgsWFSGetFeature( QgsWFSDataSourceURI &uri ); | ||
|
||
//! Issue the request | ||
bool request( bool synchronous, | ||
const QString &WFSVersion, | ||
const QString &typeName, | ||
const QString &filter, | ||
bool hitsOnly, | ||
const QgsWfsCapabilities::Capabilities &caps ); | ||
|
||
protected: | ||
QString errorMessageWithReason( const QString &reason ) override; | ||
}; | ||
|
||
#endif // QGSWFSGETFEATURE_H |
Oops, something went wrong.