Skip to content

Commit d7a48c6

Browse files
committed
[Server][WFS] Update DescribeFeatureType 1.1.0
1 parent c8a4407 commit d7a48c6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/server/services/wfs/qgswfsdescribefeaturetype.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "qgswfsutils.h"
2323
#include "qgsserverprojectutils.h"
2424
#include "qgswfsdescribefeaturetype.h"
25+
#include "qgswfsparameters.h"
2526

2627
#include "qgsproject.h"
2728
#include "qgsexception.h"
@@ -53,6 +54,13 @@ namespace QgsWfs
5354
QDomDocument doc;
5455

5556
QgsServerRequest::Parameters parameters = request.parameters();
57+
QgsWfsParameters wfsParameters( parameters );
58+
QgsWfsParameters::Format oFormat = wfsParameters.outputFormat();
59+
60+
// test oFormat
61+
if ( oFormat == QgsWfsParameters::Format::NONE )
62+
throw QgsBadRequestException( QStringLiteral( "Invalid WFS Parameter" ),
63+
"OUTPUTFORMAT " + wfsParameters.outputFormatAsString() + "is not supported" );
5664

5765
QgsAccessControl *accessControl = serverIface->accessControls();
5866

@@ -71,7 +79,10 @@ namespace QgsWfs
7179
//xsd:import
7280
QDomElement importElement = doc.createElement( QStringLiteral( "import" )/*xsd:import*/ );
7381
importElement.setAttribute( QStringLiteral( "namespace" ), GML_NAMESPACE );
74-
importElement.setAttribute( QStringLiteral( "schemaLocation" ), QStringLiteral( "http://schemas.opengis.net/gml/2.1.2/feature.xsd" ) );
82+
if ( oFormat == QgsWfsParameters::Format::GML2 )
83+
importElement.setAttribute( QStringLiteral( "schemaLocation" ), QStringLiteral( "http://schemas.opengis.net/gml/2.1.2/feature.xsd" ) );
84+
else if ( oFormat == QgsWfsParameters::Format::GML3 )
85+
importElement.setAttribute( QStringLiteral( "schemaLocation" ), QStringLiteral( "http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" ) );
7586
schemaElement.appendChild( importElement );
7687

7788
QStringList typeNameList;

0 commit comments

Comments
 (0)