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