QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgswfsgetcapabilities_1_0_0.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgswfsgecapabilities_1_0_0.cpp
3 -------------------------
4 begin : December 20 , 2016
5 copyright : (C) 2007 by Marco Hugentobler (original code)
6 (C) 2012 by René-Luc D'Hont (original code)
7 (C) 2014 by Alessandro Pasotti (original code)
8 (C) 2017 by David Marteau
9 email : marco dot hugentobler at karto dot baug dot ethz dot ch
10 a dot pasotti at itopen dot it
11 david dot marteau at 3liz dot com
12 ***************************************************************************/
13
14/***************************************************************************
15 * *
16 * This program is free software; you can redistribute it and/or modify *
17 * it under the terms of the GNU General Public License as published by *
18 * the Free Software Foundation; either version 2 of the License, or *
19 * (at your option) any later version. *
20 * *
21 ***************************************************************************/
22#include "qgswfsutils.h"
25
26#include "qgsproject.h"
27#include "qgsvectorlayer.h"
30
31namespace QgsWfs
32{
33 namespace v1_0_0
34 {
35
39 void writeGetCapabilities( QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response )
40 {
41#ifdef HAVE_SERVER_PYTHON_PLUGINS
42 QgsAccessControl *accessControl = serverIface->accessControls();
43#endif
44 QDomDocument doc;
45 const QDomDocument *capabilitiesDocument = nullptr;
46
47#ifdef HAVE_SERVER_PYTHON_PLUGINS
48 QgsServerCacheManager *cacheManager = serverIface->cacheManager();
49 if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
50 {
51 capabilitiesDocument = &doc;
52 }
53 else //capabilities xml not in cache. Create a new one
54 {
55 doc = createGetCapabilitiesDocument( serverIface, project, version, request );
56
57 if ( cacheManager )
58 {
59 cacheManager->setCachedDocument( &doc, project, request, accessControl );
60 }
61 capabilitiesDocument = &doc;
62 }
63#else
64 doc = createGetCapabilitiesDocument( serverIface, project, version, request );
65 capabilitiesDocument = &doc;
66#endif
67 response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
68 response.write( capabilitiesDocument->toByteArray() );
69 }
70
71
72 QDomDocument createGetCapabilitiesDocument( QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request )
73 {
74 Q_UNUSED( version )
75
76 QDomDocument doc;
77
78 //wfs:WFS_Capabilities element
79 QDomElement wfsCapabilitiesElement = doc.createElement( QStringLiteral( "WFS_Capabilities" ) /*wms:WFS_Capabilities*/ );
80 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns" ), WFS_NAMESPACE );
81 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
82 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xsi:schemaLocation" ), WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd" );
83 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ogc" ), OGC_NAMESPACE );
84 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:gml" ), GML_NAMESPACE );
85 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ows" ), QStringLiteral( "http://www.opengis.net/ows" ) );
86 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
87 wfsCapabilitiesElement.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0.0" ) );
88 wfsCapabilitiesElement.setAttribute( QStringLiteral( "updateSequence" ), QStringLiteral( "0" ) );
89 doc.appendChild( wfsCapabilitiesElement );
90
91 //wfs:Service
92 wfsCapabilitiesElement.appendChild( getServiceElement( doc, project ) );
93
94 //wfs:Capability
95 wfsCapabilitiesElement.appendChild( getCapabilityElement( doc, project, request, serverIface->serverSettings() ) );
96
97 //wfs:FeatureTypeList
98 wfsCapabilitiesElement.appendChild( getFeatureTypeListElement( doc, serverIface, project ) );
99
100 /*
101 * Adding ogc:Filter_Capabilities in wfsCapabilitiesElement
102 */
103 //ogc:Filter_Capabilities element
104 QDomElement filterCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Filter_Capabilities" ) /*ogc:Filter_Capabilities*/ );
105 wfsCapabilitiesElement.appendChild( filterCapabilitiesElement );
106 QDomElement spatialCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Spatial_Capabilities" ) /*ogc:Spatial_Capabilities*/ );
107 filterCapabilitiesElement.appendChild( spatialCapabilitiesElement );
108 QDomElement spatialOperatorsElement = doc.createElement( QStringLiteral( "ogc:Spatial_Operators" ) /*ogc:Spatial_Operators*/ );
109 spatialCapabilitiesElement.appendChild( spatialOperatorsElement );
110 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:BBOX" ) /*ogc:BBOX*/ ) );
111 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Disjoint" ) /*ogc:Disjoint*/ ) );
112 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Intersect" ) /*ogc:Intersects*/ ) );
113 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Touches" ) /*ogc:Touches*/ ) );
114 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Crosses" ) /*ogc:Crosses*/ ) );
115 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Contains" ) /*ogc:Contains*/ ) );
116 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Overlaps" ) /*ogc:Overlaps*/ ) );
117 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Within" ) /*ogc:Within*/ ) );
118 QDomElement scalarCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Scalar_Capabilities" ) /*ogc:Scalar_Capabilities*/ );
119 filterCapabilitiesElement.appendChild( scalarCapabilitiesElement );
120 QDomElement comparisonOperatorsElement = doc.createElement( QStringLiteral( "ogc:Comparison_Operators" ) /*ogc:Comparison_Operators*/ );
121 scalarCapabilitiesElement.appendChild( comparisonOperatorsElement );
122 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Simple_Comparisons" ) /*ogc:Simple_Comparisons*/ ) );
123 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Between" ) /*ogc:Between*/ ) );
124 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Like" ) /*ogc:Like*/ ) );
125
126 return doc;
127 }
128
129 QDomElement getServiceElement( QDomDocument &doc, const QgsProject *project )
130 {
131 //Service element
132 QDomElement serviceElem = doc.createElement( QStringLiteral( "Service" ) );
133
134 //Service name
135 QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
136 const QDomText nameText = doc.createTextNode( "WFS" );
137 nameElem.appendChild( nameText );
138 serviceElem.appendChild( nameElem );
139
140 const QString title = QgsServerProjectUtils::owsServiceTitle( *project );
141 QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
142 const QDomText titleText = doc.createTextNode( title );
143 titleElem.appendChild( titleText );
144 serviceElem.appendChild( titleElem );
145
146 const QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
147 if ( !abstract.isEmpty() )
148 {
149 QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
150 const QDomText abstractText = doc.createCDATASection( abstract );
151 abstractElem.appendChild( abstractText );
152 serviceElem.appendChild( abstractElem );
153 }
154
155 const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
156 if ( !keywords.isEmpty() && !keywords.join( QLatin1String( ", " ) ).isEmpty() )
157 {
158 QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
159 const QDomText keywordsText = doc.createTextNode( keywords.join( QLatin1String( ", " ) ) );
160 keywordsElem.appendChild( keywordsText );
161 serviceElem.appendChild( keywordsElem );
162 }
163
164 QDomElement onlineResourceElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
165 const QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
166 if ( !onlineResource.isEmpty() )
167 {
168 const QDomText onlineResourceText = doc.createTextNode( onlineResource );
169 onlineResourceElem.appendChild( onlineResourceText );
170 }
171 serviceElem.appendChild( onlineResourceElem );
172
173 const QString fees = QgsServerProjectUtils::owsServiceFees( *project );
174 if ( !fees.isEmpty() )
175 {
176 QDomElement feesElem = doc.createElement( QStringLiteral( "Fees" ) );
177 const QDomText feesText = doc.createTextNode( fees );
178 feesElem.appendChild( feesText );
179 serviceElem.appendChild( feesElem );
180 }
181
182 const QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
183 if ( !accessConstraints.isEmpty() )
184 {
185 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral( "AccessConstraints" ) );
186 const QDomText accessConstraintsText = doc.createTextNode( accessConstraints );
187 accessConstraintsElem.appendChild( accessConstraintsText );
188 serviceElem.appendChild( accessConstraintsElem );
189 }
190
191 return serviceElem;
192 }
193
194 QDomElement getCapabilityElement( QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request, const QgsServerSettings *settings )
195 {
196 //wfs:Capability element
197 QDomElement capabilityElement = doc.createElement( QStringLiteral( "Capability" ) /*wfs:Capability*/ );
198
199 //wfs:Request element
200 QDomElement requestElement = doc.createElement( QStringLiteral( "Request" ) /*wfs:Request*/ );
201 capabilityElement.appendChild( requestElement );
202 //wfs:GetCapabilities
203 QDomElement getCapabilitiesElement = doc.createElement( QStringLiteral( "GetCapabilities" ) /*wfs:GetCapabilities*/ );
204 requestElement.appendChild( getCapabilitiesElement );
205
206 QDomElement dcpTypeElement = doc.createElement( QStringLiteral( "DCPType" ) /*wfs:DCPType*/ );
207 getCapabilitiesElement.appendChild( dcpTypeElement );
208 QDomElement httpElement = doc.createElement( QStringLiteral( "HTTP" ) /*wfs:HTTP*/ );
209 dcpTypeElement.appendChild( httpElement );
210
211 //Prepare url
212 const QString hrefString = serviceUrl( request, project, *settings );
213
214 //only Get supported for the moment
215 QDomElement getElement = doc.createElement( QStringLiteral( "Get" ) /*wfs:Get*/ );
216 httpElement.appendChild( getElement );
217 getElement.setAttribute( QStringLiteral( "onlineResource" ), hrefString );
218 const QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
219 getCapabilitiesDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
220 getCapabilitiesElement.appendChild( getCapabilitiesDhcTypePostElement );
221
222 //wfs:DescribeFeatureType
223 QDomElement describeFeatureTypeElement = doc.createElement( QStringLiteral( "DescribeFeatureType" ) /*wfs:DescribeFeatureType*/ );
224 requestElement.appendChild( describeFeatureTypeElement );
225 QDomElement schemaDescriptionLanguageElement = doc.createElement( QStringLiteral( "SchemaDescriptionLanguage" ) /*wfs:SchemaDescriptionLanguage*/ );
226 describeFeatureTypeElement.appendChild( schemaDescriptionLanguageElement );
227 const QDomElement xmlSchemaElement = doc.createElement( QStringLiteral( "XMLSCHEMA" ) /*wfs:XMLSCHEMA*/ );
228 schemaDescriptionLanguageElement.appendChild( xmlSchemaElement );
229 const QDomElement describeFeatureTypeDhcTypeElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
230 describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypeElement );
231 const QDomElement describeFeatureTypeDhcTypePostElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
232 describeFeatureTypeDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
233 describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypePostElement );
234
235 //wfs:GetFeature
236 QDomElement getFeatureElement = doc.createElement( QStringLiteral( "GetFeature" ) /*wfs:GetFeature*/ );
237 requestElement.appendChild( getFeatureElement );
238 QDomElement getFeatureFormatElement = doc.createElement( QStringLiteral( "ResultFormat" ) ); /*wfs:ResultFormat*/
239 getFeatureElement.appendChild( getFeatureFormatElement );
240 const QDomElement gmlFormatElement = doc.createElement( QStringLiteral( "GML2" ) ); /*wfs:GML2*/
241 getFeatureFormatElement.appendChild( gmlFormatElement );
242 const QDomElement gml3FormatElement = doc.createElement( QStringLiteral( "GML3" ) ); /*wfs:GML3*/
243 getFeatureFormatElement.appendChild( gml3FormatElement );
244 const QDomElement geojsonFormatElement = doc.createElement( QStringLiteral( "GeoJSON" ) ); /*wfs:GeoJSON*/
245 getFeatureFormatElement.appendChild( geojsonFormatElement );
246 const QDomElement getFeatureDhcTypeGetElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
247 getFeatureElement.appendChild( getFeatureDhcTypeGetElement );
248 const QDomElement getFeatureDhcTypePostElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
249 getFeatureDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
250 getFeatureElement.appendChild( getFeatureDhcTypePostElement );
251
252 //wfs:Transaction
253 QDomElement transactionElement = doc.createElement( QStringLiteral( "Transaction" ) /*wfs:Transaction*/ );
254 requestElement.appendChild( transactionElement );
255 const QDomElement transactionDhcTypeElement = dcpTypeElement.cloneNode().toElement(); //this is the same as for 'GetCapabilities'
256 transactionDhcTypeElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
257 transactionElement.appendChild( transactionDhcTypeElement );
258
259 return capabilityElement;
260 }
261
262 QDomElement getFeatureTypeListElement( QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project )
263 {
264#ifdef HAVE_SERVER_PYTHON_PLUGINS
265 QgsAccessControl *accessControl = serverIface->accessControls();
266#else
267 ( void ) serverIface;
268#endif
269
270 //wfs:FeatureTypeList element
271 QDomElement featureTypeListElement = doc.createElement( QStringLiteral( "FeatureTypeList" ) /*wfs:FeatureTypeList*/ );
272 //wfs:Operations element
273 QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" ) /*wfs:Operations*/ );
274 featureTypeListElement.appendChild( operationsElement );
275 //wfs:Query element
276 const QDomElement queryElement = doc.createElement( QStringLiteral( "Query" ) /*wfs:Query*/ );
277 operationsElement.appendChild( queryElement );
278
279 const QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
280 const QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
281 const QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
282 const QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
283 for ( const QString &wfsLayerId : wfsLayerIds )
284 {
285 QgsMapLayer *layer = project->mapLayer( wfsLayerId );
286 if ( !layer )
287 {
288 continue;
289 }
290 if ( layer->type() != Qgis::LayerType::Vector )
291 {
292 continue;
293 }
294#ifdef HAVE_SERVER_PYTHON_PLUGINS
295 if ( accessControl && !accessControl->layerReadPermission( layer ) )
296 {
297 continue;
298 }
299#endif
300 QDomElement layerElem = doc.createElement( QStringLiteral( "FeatureType" ) );
301
302 //create Name
303 QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
304 QString typeName = layer->name();
305 if ( !layer->serverProperties()->shortName().isEmpty() )
306 typeName = layer->serverProperties()->shortName();
307 typeName = typeName.replace( QLatin1String( " " ), QLatin1String( "_" ) );
308 const QDomText nameText = doc.createTextNode( typeName );
309 nameElem.appendChild( nameText );
310 layerElem.appendChild( nameElem );
311
312 //create Title
313 QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
314 QString title = layer->serverProperties()->title();
315 if ( title.isEmpty() )
316 {
317 title = layer->name();
318 }
319 const QDomText titleText = doc.createTextNode( title );
320 titleElem.appendChild( titleText );
321 layerElem.appendChild( titleElem );
322
323 //create Abstract
324 const QString abstract = layer->serverProperties()->abstract();
325 if ( !abstract.isEmpty() )
326 {
327 QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
328 const QDomText abstractText = doc.createTextNode( abstract );
329 abstractElem.appendChild( abstractText );
330 layerElem.appendChild( abstractElem );
331 }
332
333 //create keywords
334 const QString keywords = layer->serverProperties()->keywordList();
335 if ( !keywords.isEmpty() )
336 {
337 QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
338 const QDomText keywordsText = doc.createTextNode( keywords );
339 keywordsElem.appendChild( keywordsText );
340 layerElem.appendChild( keywordsElem );
341 }
342
343 //create SRS
344 QDomElement srsElem = doc.createElement( QStringLiteral( "SRS" ) );
345 const QDomText srsText = doc.createTextNode( layer->crs().authid() );
346 srsElem.appendChild( srsText );
347 layerElem.appendChild( srsElem );
348
349 // Define precision
350 int precision = 3;
351 if ( layer->crs().isGeographic() )
352 {
353 precision = 6;
354 }
355
356 //create LatLongBoundingBox
357 const QgsRectangle layerExtent = layer->extent();
358 QDomElement bBoxElement = doc.createElement( QStringLiteral( "LatLongBoundingBox" ) );
359 bBoxElement.setAttribute( QStringLiteral( "minx" ), qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerExtent.xMinimum(), precision ), precision ) );
360 bBoxElement.setAttribute( QStringLiteral( "miny" ), qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerExtent.yMinimum(), precision ), precision ) );
361 bBoxElement.setAttribute( QStringLiteral( "maxx" ), qgsDoubleToString( QgsServerProjectUtils::ceilWithPrecision( layerExtent.xMaximum(), precision ), precision ) );
362 bBoxElement.setAttribute( QStringLiteral( "maxy" ), qgsDoubleToString( QgsServerProjectUtils::ceilWithPrecision( layerExtent.yMaximum(), precision ), precision ) );
363 layerElem.appendChild( bBoxElement );
364
365 // layer metadata URL
366 const QList<QgsMapLayerServerProperties::MetadataUrl> urls = layer->serverProperties()->metadataUrls();
367 for ( const QgsMapLayerServerProperties::MetadataUrl &url : urls )
368 {
369 QDomElement metaUrlElem = doc.createElement( QStringLiteral( "MetadataURL" ) );
370 const QString metadataUrlType = url.type;
371 metaUrlElem.setAttribute( QStringLiteral( "type" ), metadataUrlType );
372 const QString metadataUrlFormat = url.format;
373 if ( metadataUrlFormat == QLatin1String( "text/xml" ) )
374 {
375 metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "XML" ) );
376 }
377 else
378 {
379 metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "TXT" ) );
380 }
381 const QDomText metaUrlText = doc.createTextNode( url.url );
382 metaUrlElem.appendChild( metaUrlText );
383 layerElem.appendChild( metaUrlElem );
384 }
385
386 //wfs:Operations element
387 QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" ) /*wfs:Operations*/ );
388 //wfs:Query element
389 const QDomElement queryElement = doc.createElement( QStringLiteral( "Query" ) /*wfs:Query*/ );
390 operationsElement.appendChild( queryElement );
391 if ( wfstUpdateLayersId.contains( layer->id() ) || wfstInsertLayersId.contains( layer->id() ) || wfstDeleteLayersId.contains( layer->id() ) )
392 {
393 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
394 QgsVectorDataProvider *provider = vlayer->dataProvider();
395 if ( ( provider->capabilities() & Qgis::VectorProviderCapability::AddFeatures ) && wfstInsertLayersId.contains( layer->id() ) )
396 {
397 //wfs:Insert element
398 const QDomElement insertElement = doc.createElement( QStringLiteral( "Insert" ) /*wfs:Insert*/ );
399 operationsElement.appendChild( insertElement );
400 }
401 if ( ( provider->capabilities() & Qgis::VectorProviderCapability::ChangeAttributeValues ) && ( provider->capabilities() & Qgis::VectorProviderCapability::ChangeGeometries ) && wfstUpdateLayersId.contains( layer->id() ) )
402 {
403 //wfs:Update element
404 const QDomElement updateElement = doc.createElement( QStringLiteral( "Update" ) /*wfs:Update*/ );
405 operationsElement.appendChild( updateElement );
406 }
407 if ( ( provider->capabilities() & Qgis::VectorProviderCapability::DeleteFeatures ) && wfstDeleteLayersId.contains( layer->id() ) )
408 {
409 //wfs:Delete element
410 const QDomElement deleteElement = doc.createElement( QStringLiteral( "Delete" ) /*wfs:Delete*/ );
411 operationsElement.appendChild( deleteElement );
412 }
413 }
414
415 layerElem.appendChild( operationsElement );
416
417 featureTypeListElement.appendChild( layerElem );
418 }
419
420 return featureTypeListElement;
421 }
422
423 } // namespace v1_0_0
424} // namespace QgsWfs
@ AddFeatures
Allows adding features.
@ ChangeGeometries
Allows modifications of geometries.
@ DeleteFeatures
Allows deletion of features.
@ ChangeAttributeValues
Allows modification of attribute values.
@ Vector
Vector layer.
A helper class that centralizes restrictions given by all the access control filter plugins.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QString keywordList() const
Returns the keyword list of the layerused by QGIS Server in GetCapabilities request.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QString abstract() const
Returns the abstract of the layerused by QGIS Server in GetCapabilities request.
Base class for all map layer types.
Definition qgsmaplayer.h:76
QString name
Definition qgsmaplayer.h:80
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
Definition qgsmaplayer.h:83
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
QString id
Definition qgsmaplayer.h:79
Qgis::LayerType type
Definition qgsmaplayer.h:86
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
A rectangle specified with double values.
double xMinimum
double yMinimum
double xMaximum
double yMaximum
A helper class that centralizes caches accesses given by all the server cache filter plugins.
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
bool getCachedDocument(QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Returns cached document (or 0 if document not in cache) like capabilities.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
virtual QgsServerCacheManager * cacheManager() const =0
Gets the registered server cache filters.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
virtual QgsServerSettings * serverSettings()=0
Returns the server settings.
QList< QgsServerMetadataUrlProperties::MetadataUrl > metadataUrls() const
Returns a list of metadataUrl resources associated for the layer.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device.
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
Provides a way to retrieve settings by prioritizing according to environment variables,...
This is the base class for vector data providers.
virtual Q_INVOKABLE Qgis::VectorProviderCapabilities capabilities() const
Returns flags containing the supported capabilities.
Represents a vector layer which manages a vector based data sets.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
SERVER_EXPORT double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
SERVER_EXPORT QString owsServiceAccessConstraints(const QgsProject &project)
Returns the owsService access constraints defined in project.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
SERVER_EXPORT QString owsServiceOnlineResource(const QgsProject &project)
Returns the owsService online resource defined in project.
SERVER_EXPORT QString owsServiceFees(const QgsProject &project)
Returns the owsService fees defined in project.
SERVER_EXPORT QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
SERVER_EXPORT QStringList wfstUpdateLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
SERVER_EXPORT QStringList wfstInsertLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
SERVER_EXPORT QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
SERVER_EXPORT QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
SERVER_EXPORT double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
SERVER_EXPORT QStringList wfstDeleteLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
void writeGetCapabilities(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WFS GetCapabilities response.
QDomElement getFeatureTypeListElement(QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project)
Create FeatureTypeList element for get capabilities document.
QDomDocument createGetCapabilitiesDocument(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request)
Create get capabilities document.
QDomElement getCapabilityElement(QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request, const QgsServerSettings *settings)
Create Capability element for get capabilities document.
QDomElement getServiceElement(QDomDocument &doc, const QgsProject *project)
Create Service element for get capabilities document.
WMS implementation.
Definition qgswfs.cpp:36
QString serviceUrl(const QgsServerRequest &request, const QgsProject *project, const QgsServerSettings &settings)
Service URL string.
const QString OGC_NAMESPACE
Definition qgswfsutils.h:76
const QString GML_NAMESPACE
Definition qgswfsutils.h:75
const QString WFS_NAMESPACE
Definition qgswfsutils.h:74
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition qgis.h:5983
const QString & typeName
int precision