QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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,
40 const QgsServerRequest &request, QgsServerResponse &response )
41 {
42#ifdef HAVE_SERVER_PYTHON_PLUGINS
43 QgsAccessControl *accessControl = serverIface->accessControls();
44#endif
45 QDomDocument doc;
46 const QDomDocument *capabilitiesDocument = nullptr;
47
48#ifdef HAVE_SERVER_PYTHON_PLUGINS
49 QgsServerCacheManager *cacheManager = serverIface->cacheManager();
50 if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
51 {
52 capabilitiesDocument = &doc;
53 }
54 else //capabilities xml not in cache. Create a new one
55 {
56 doc = createGetCapabilitiesDocument( serverIface, project, version, request );
57
58 if ( cacheManager )
59 {
60 cacheManager->setCachedDocument( &doc, project, request, accessControl );
61 }
62 capabilitiesDocument = &doc;
63 }
64#else
65 doc = createGetCapabilitiesDocument( serverIface, project, version, request );
66 capabilitiesDocument = &doc;
67#endif
68 response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
69 response.write( capabilitiesDocument->toByteArray() );
70 }
71
72
73 QDomDocument createGetCapabilitiesDocument( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
74 const QgsServerRequest &request )
75 {
76 Q_UNUSED( version )
77
78 QDomDocument doc;
79
80 //wfs:WFS_Capabilities element
81 QDomElement wfsCapabilitiesElement = doc.createElement( QStringLiteral( "WFS_Capabilities" )/*wms:WFS_Capabilities*/ );
82 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns" ), WFS_NAMESPACE );
83 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
84 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xsi:schemaLocation" ), WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd" );
85 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ogc" ), OGC_NAMESPACE );
86 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:gml" ), GML_NAMESPACE );
87 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:ows" ), QStringLiteral( "http://www.opengis.net/ows" ) );
88 wfsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
89 wfsCapabilitiesElement.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0.0" ) );
90 wfsCapabilitiesElement.setAttribute( QStringLiteral( "updateSequence" ), QStringLiteral( "0" ) );
91 doc.appendChild( wfsCapabilitiesElement );
92
93 //wfs:Service
94 wfsCapabilitiesElement.appendChild( getServiceElement( doc, project ) );
95
96 //wfs:Capability
97 wfsCapabilitiesElement.appendChild( getCapabilityElement( doc, project, request, serverIface->serverSettings() ) );
98
99 //wfs:FeatureTypeList
100 wfsCapabilitiesElement.appendChild( getFeatureTypeListElement( doc, serverIface, project ) );
101
102 /*
103 * Adding ogc:Filter_Capabilities in wfsCapabilitiesElement
104 */
105 //ogc:Filter_Capabilities element
106 QDomElement filterCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Filter_Capabilities" )/*ogc:Filter_Capabilities*/ );
107 wfsCapabilitiesElement.appendChild( filterCapabilitiesElement );
108 QDomElement spatialCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Spatial_Capabilities" )/*ogc:Spatial_Capabilities*/ );
109 filterCapabilitiesElement.appendChild( spatialCapabilitiesElement );
110 QDomElement spatialOperatorsElement = doc.createElement( QStringLiteral( "ogc:Spatial_Operators" )/*ogc:Spatial_Operators*/ );
111 spatialCapabilitiesElement.appendChild( spatialOperatorsElement );
112 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:BBOX" )/*ogc:BBOX*/ ) );
113 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Disjoint" )/*ogc:Disjoint*/ ) );
114 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Intersect" )/*ogc:Intersects*/ ) );
115 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Touches" )/*ogc:Touches*/ ) );
116 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Crosses" )/*ogc:Crosses*/ ) );
117 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Contains" )/*ogc:Contains*/ ) );
118 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Overlaps" )/*ogc:Overlaps*/ ) );
119 spatialOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Within" )/*ogc:Within*/ ) );
120 QDomElement scalarCapabilitiesElement = doc.createElement( QStringLiteral( "ogc:Scalar_Capabilities" )/*ogc:Scalar_Capabilities*/ );
121 filterCapabilitiesElement.appendChild( scalarCapabilitiesElement );
122 QDomElement comparisonOperatorsElement = doc.createElement( QStringLiteral( "ogc:Comparison_Operators" )/*ogc:Comparison_Operators*/ );
123 scalarCapabilitiesElement.appendChild( comparisonOperatorsElement );
124 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Simple_Comparisons" )/*ogc:Simple_Comparisons*/ ) );
125 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Between" )/*ogc:Between*/ ) );
126 comparisonOperatorsElement.appendChild( doc.createElement( QStringLiteral( "ogc:Like" )/*ogc:Like*/ ) );
127
128 return doc;
129
130 }
131
132 QDomElement getServiceElement( QDomDocument &doc, const QgsProject *project )
133 {
134 //Service element
135 QDomElement serviceElem = doc.createElement( QStringLiteral( "Service" ) );
136
137 //Service name
138 QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
139 const QDomText nameText = doc.createTextNode( "WFS" );
140 nameElem.appendChild( nameText );
141 serviceElem.appendChild( nameElem );
142
143 const QString title = QgsServerProjectUtils::owsServiceTitle( *project );
144 QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
145 const QDomText titleText = doc.createTextNode( title );
146 titleElem.appendChild( titleText );
147 serviceElem.appendChild( titleElem );
148
149 const QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
150 if ( !abstract.isEmpty() )
151 {
152 QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
153 const QDomText abstractText = doc.createCDATASection( abstract );
154 abstractElem.appendChild( abstractText );
155 serviceElem.appendChild( abstractElem );
156 }
157
158 const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
159 if ( !keywords.isEmpty() && !keywords.join( QLatin1String( ", " ) ).isEmpty() )
160 {
161 QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
162 const QDomText keywordsText = doc.createTextNode( keywords.join( QLatin1String( ", " ) ) );
163 keywordsElem.appendChild( keywordsText );
164 serviceElem.appendChild( keywordsElem );
165 }
166
167 QDomElement onlineResourceElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
168 const QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
169 if ( !onlineResource.isEmpty() )
170 {
171 const QDomText onlineResourceText = doc.createTextNode( onlineResource );
172 onlineResourceElem.appendChild( onlineResourceText );
173 }
174 serviceElem.appendChild( onlineResourceElem );
175
176 const QString fees = QgsServerProjectUtils::owsServiceFees( *project );
177 if ( !fees.isEmpty() )
178 {
179 QDomElement feesElem = doc.createElement( QStringLiteral( "Fees" ) );
180 const QDomText feesText = doc.createTextNode( fees );
181 feesElem.appendChild( feesText );
182 serviceElem.appendChild( feesElem );
183 }
184
185 const QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
186 if ( !accessConstraints.isEmpty() )
187 {
188 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral( "AccessConstraints" ) );
189 const QDomText accessConstraintsText = doc.createTextNode( accessConstraints );
190 accessConstraintsElem.appendChild( accessConstraintsText );
191 serviceElem.appendChild( accessConstraintsElem );
192 }
193
194 return serviceElem;
195
196 }
197
198 QDomElement getCapabilityElement( QDomDocument &doc, const QgsProject *project, const QgsServerRequest &request, const QgsServerSettings *settings )
199 {
200 //wfs:Capability element
201 QDomElement capabilityElement = doc.createElement( QStringLiteral( "Capability" )/*wfs:Capability*/ );
202
203 //wfs:Request element
204 QDomElement requestElement = doc.createElement( QStringLiteral( "Request" )/*wfs:Request*/ );
205 capabilityElement.appendChild( requestElement );
206 //wfs:GetCapabilities
207 QDomElement getCapabilitiesElement = doc.createElement( QStringLiteral( "GetCapabilities" )/*wfs:GetCapabilities*/ );
208 requestElement.appendChild( getCapabilitiesElement );
209
210 QDomElement dcpTypeElement = doc.createElement( QStringLiteral( "DCPType" )/*wfs:DCPType*/ );
211 getCapabilitiesElement.appendChild( dcpTypeElement );
212 QDomElement httpElement = doc.createElement( QStringLiteral( "HTTP" )/*wfs:HTTP*/ );
213 dcpTypeElement.appendChild( httpElement );
214
215 //Prepare url
216 const QString hrefString = serviceUrl( request, project, *settings );
217
218 //only Get supported for the moment
219 QDomElement getElement = doc.createElement( QStringLiteral( "Get" )/*wfs:Get*/ );
220 httpElement.appendChild( getElement );
221 getElement.setAttribute( QStringLiteral( "onlineResource" ), hrefString );
222 const QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
223 getCapabilitiesDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
224 getCapabilitiesElement.appendChild( getCapabilitiesDhcTypePostElement );
225
226 //wfs:DescribeFeatureType
227 QDomElement describeFeatureTypeElement = doc.createElement( QStringLiteral( "DescribeFeatureType" )/*wfs:DescribeFeatureType*/ );
228 requestElement.appendChild( describeFeatureTypeElement );
229 QDomElement schemaDescriptionLanguageElement = doc.createElement( QStringLiteral( "SchemaDescriptionLanguage" )/*wfs:SchemaDescriptionLanguage*/ );
230 describeFeatureTypeElement.appendChild( schemaDescriptionLanguageElement );
231 const QDomElement xmlSchemaElement = doc.createElement( QStringLiteral( "XMLSCHEMA" )/*wfs:XMLSCHEMA*/ );
232 schemaDescriptionLanguageElement.appendChild( xmlSchemaElement );
233 const QDomElement describeFeatureTypeDhcTypeElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
234 describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypeElement );
235 const QDomElement describeFeatureTypeDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
236 describeFeatureTypeDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
237 describeFeatureTypeElement.appendChild( describeFeatureTypeDhcTypePostElement );
238
239 //wfs:GetFeature
240 QDomElement getFeatureElement = doc.createElement( QStringLiteral( "GetFeature" )/*wfs:GetFeature*/ );
241 requestElement.appendChild( getFeatureElement );
242 QDomElement getFeatureFormatElement = doc.createElement( QStringLiteral( "ResultFormat" ) );/*wfs:ResultFormat*/
243 getFeatureElement.appendChild( getFeatureFormatElement );
244 const QDomElement gmlFormatElement = doc.createElement( QStringLiteral( "GML2" ) );/*wfs:GML2*/
245 getFeatureFormatElement.appendChild( gmlFormatElement );
246 const QDomElement gml3FormatElement = doc.createElement( QStringLiteral( "GML3" ) );/*wfs:GML3*/
247 getFeatureFormatElement.appendChild( gml3FormatElement );
248 const QDomElement geojsonFormatElement = doc.createElement( QStringLiteral( "GeoJSON" ) );/*wfs:GeoJSON*/
249 getFeatureFormatElement.appendChild( geojsonFormatElement );
250 const QDomElement getFeatureDhcTypeGetElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
251 getFeatureElement.appendChild( getFeatureDhcTypeGetElement );
252 const QDomElement getFeatureDhcTypePostElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
253 getFeatureDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
254 getFeatureElement.appendChild( getFeatureDhcTypePostElement );
255
256 //wfs:Transaction
257 QDomElement transactionElement = doc.createElement( QStringLiteral( "Transaction" )/*wfs:Transaction*/ );
258 requestElement.appendChild( transactionElement );
259 const QDomElement transactionDhcTypeElement = dcpTypeElement.cloneNode().toElement();//this is the same as for 'GetCapabilities'
260 transactionDhcTypeElement.firstChild().firstChild().toElement().setTagName( QStringLiteral( "Post" ) );
261 transactionElement.appendChild( transactionDhcTypeElement );
262
263 return capabilityElement;
264 }
265
266 QDomElement getFeatureTypeListElement( QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project )
267 {
268#ifdef HAVE_SERVER_PYTHON_PLUGINS
269 QgsAccessControl *accessControl = serverIface->accessControls();
270#else
271 ( void )serverIface;
272#endif
273
274 //wfs:FeatureTypeList element
275 QDomElement featureTypeListElement = doc.createElement( QStringLiteral( "FeatureTypeList" )/*wfs:FeatureTypeList*/ );
276 //wfs:Operations element
277 QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
278 featureTypeListElement.appendChild( operationsElement );
279 //wfs:Query element
280 const QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
281 operationsElement.appendChild( queryElement );
282
283 const QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
284 const QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
285 const QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
286 const QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
287 for ( const QString &wfsLayerId : wfsLayerIds )
288 {
289 QgsMapLayer *layer = project->mapLayer( wfsLayerId );
290 if ( !layer )
291 {
292 continue;
293 }
294 if ( layer->type() != Qgis::LayerType::Vector )
295 {
296 continue;
297 }
298#ifdef HAVE_SERVER_PYTHON_PLUGINS
299 if ( accessControl && !accessControl->layerReadPermission( layer ) )
300 {
301 continue;
302 }
303#endif
304 QDomElement layerElem = doc.createElement( QStringLiteral( "FeatureType" ) );
305
306 //create Name
307 QDomElement nameElem = doc.createElement( QStringLiteral( "Name" ) );
308 QString typeName = layer->name();
309 if ( !layer->serverProperties()->shortName().isEmpty() )
310 typeName = layer->serverProperties()->shortName();
311 typeName = typeName.replace( QLatin1String( " " ), QLatin1String( "_" ) );
312 const QDomText nameText = doc.createTextNode( typeName );
313 nameElem.appendChild( nameText );
314 layerElem.appendChild( nameElem );
315
316 //create Title
317 QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
318 QString title = layer->serverProperties()->title();
319 if ( title.isEmpty() )
320 {
321 title = layer->name();
322 }
323 const QDomText titleText = doc.createTextNode( title );
324 titleElem.appendChild( titleText );
325 layerElem.appendChild( titleElem );
326
327 //create Abstract
328 const QString abstract = layer->serverProperties()->abstract();
329 if ( !abstract.isEmpty() )
330 {
331 QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
332 const QDomText abstractText = doc.createTextNode( abstract );
333 abstractElem.appendChild( abstractText );
334 layerElem.appendChild( abstractElem );
335 }
336
337 //create keywords
338 const QString keywords = layer->serverProperties()->keywordList();
339 if ( !keywords.isEmpty() )
340 {
341 QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
342 const QDomText keywordsText = doc.createTextNode( keywords );
343 keywordsElem.appendChild( keywordsText );
344 layerElem.appendChild( keywordsElem );
345 }
346
347 //create SRS
348 QDomElement srsElem = doc.createElement( QStringLiteral( "SRS" ) );
349 const QDomText srsText = doc.createTextNode( layer->crs().authid() );
350 srsElem.appendChild( srsText );
351 layerElem.appendChild( srsElem );
352
353 // Define precision
354 int precision = 3;
355 if ( layer->crs().isGeographic() )
356 {
357 precision = 6;
358 }
359
360 //create LatLongBoundingBox
361 const QgsRectangle layerExtent = layer->extent();
362 QDomElement bBoxElement = doc.createElement( QStringLiteral( "LatLongBoundingBox" ) );
363 bBoxElement.setAttribute( QStringLiteral( "minx" ), qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerExtent.xMinimum(), precision ), precision ) );
364 bBoxElement.setAttribute( QStringLiteral( "miny" ), qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerExtent.yMinimum(), precision ), precision ) );
365 bBoxElement.setAttribute( QStringLiteral( "maxx" ), qgsDoubleToString( QgsServerProjectUtils::ceilWithPrecision( layerExtent.xMaximum(), precision ), precision ) );
366 bBoxElement.setAttribute( QStringLiteral( "maxy" ), qgsDoubleToString( QgsServerProjectUtils::ceilWithPrecision( layerExtent.yMaximum(), precision ), precision ) );
367 layerElem.appendChild( bBoxElement );
368
369 // layer metadata URL
370 const QList<QgsMapLayerServerProperties::MetadataUrl> urls = layer->serverProperties()->metadataUrls();
371 for ( const QgsMapLayerServerProperties::MetadataUrl &url : urls )
372 {
373 QDomElement metaUrlElem = doc.createElement( QStringLiteral( "MetadataURL" ) );
374 const QString metadataUrlType = url.type;
375 metaUrlElem.setAttribute( QStringLiteral( "type" ), metadataUrlType );
376 const QString metadataUrlFormat = url.format;
377 if ( metadataUrlFormat == QLatin1String( "text/xml" ) )
378 {
379 metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "XML" ) );
380 }
381 else
382 {
383 metaUrlElem.setAttribute( QStringLiteral( "format" ), QStringLiteral( "TXT" ) );
384 }
385 const QDomText metaUrlText = doc.createTextNode( url.url );
386 metaUrlElem.appendChild( metaUrlText );
387 layerElem.appendChild( metaUrlElem );
388 }
389
390 //wfs:Operations element
391 QDomElement operationsElement = doc.createElement( QStringLiteral( "Operations" )/*wfs:Operations*/ );
392 //wfs:Query element
393 const QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
394 operationsElement.appendChild( queryElement );
395 if ( wfstUpdateLayersId.contains( layer->id() ) ||
396 wfstInsertLayersId.contains( layer->id() ) ||
397 wfstDeleteLayersId.contains( layer->id() ) )
398 {
399 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
400 QgsVectorDataProvider *provider = vlayer->dataProvider();
401 if ( ( provider->capabilities() & Qgis::VectorProviderCapability::AddFeatures ) && wfstInsertLayersId.contains( layer->id() ) )
402 {
403 //wfs:Insert element
404 const QDomElement insertElement = doc.createElement( QStringLiteral( "Insert" )/*wfs:Insert*/ );
405 operationsElement.appendChild( insertElement );
406 }
409 wfstUpdateLayersId.contains( layer->id() ) )
410 {
411 //wfs:Update element
412 const QDomElement updateElement = doc.createElement( QStringLiteral( "Update" )/*wfs:Update*/ );
413 operationsElement.appendChild( updateElement );
414 }
415 if ( ( provider->capabilities() & Qgis::VectorProviderCapability::DeleteFeatures ) && wfstDeleteLayersId.contains( layer->id() ) )
416 {
417 //wfs:Delete element
418 const QDomElement deleteElement = doc.createElement( QStringLiteral( "Delete" )/*wfs:Delete*/ );
419 operationsElement.appendChild( deleteElement );
420 }
421 }
422
423 layerElem.appendChild( operationsElement );
424
425 featureTypeListElement.appendChild( layerElem );
426 }
427
428 return featureTypeListElement;
429 }
430
431 } // namespace v1_0_0
432} // namespace QgsWfs
433
434
435
@ 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() const
Returns the x minimum value (left side of rectangle).
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
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:5875
const QString & typeName
int precision