QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsserverprojectutils.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsserverprojectutils.cpp
3 -------------------------
4 begin : December 19, 2016
5 copyright : (C) 2016 by Paul Blottiere
6 email : paul dot blottiere at oslandia dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19
20#include "qgsmessagelog.h"
21#include "qgsproject.h"
22
23double QgsServerProjectUtils::ceilWithPrecision( double number, int places )
24{
25 const double scaleFactor = std::pow( 10.0, places );
26 return ( std::ceil( number * scaleFactor ) / scaleFactor );
27}
28
29double QgsServerProjectUtils::floorWithPrecision( double number, int places )
30{
31 const double scaleFactor = std::pow( 10.0, places );
32 return ( std::floor( number * scaleFactor ) / scaleFactor );
33}
34
36{
37 return project.readBoolEntry( QStringLiteral( "WMSServiceCapabilities" ), QStringLiteral( "/" ), false );
38}
39
41{
42 QString title = project.readEntry( QStringLiteral( "WMSServiceTitle" ), QStringLiteral( "/" ) );
43 if ( title.isEmpty() )
44 {
45 title = project.title();
46 }
47 if ( title.isEmpty() )
48 {
49 title = QObject::tr( "Untitled" );
50 }
51 return title;
52}
53
55{
56 return project.readEntry( QStringLiteral( "WMSServiceAbstract" ), QStringLiteral( "/" ) );
57}
58
60{
61 QStringList keywordList;
62 const QStringList list = project.readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ), QStringList() );
63 if ( !list.isEmpty() )
64 {
65 for ( int i = 0; i < list.size(); ++i )
66 {
67 const QString keyword = list.at( i );
68 if ( !keyword.isEmpty() )
69 {
70 keywordList.append( keyword );
71 }
72 }
73 }
74 return keywordList;
75}
76
78{
79 QString wmsOnlineResource = project.readEntry( QStringLiteral( "WMSOnlineResource" ), QStringLiteral( "/" ) );
80
82 if ( wmsOnlineResourceProperty.isActive() && !wmsOnlineResourceProperty.expressionString().isEmpty() )
83 {
84 const QgsExpressionContext context = project.createExpressionContext();
85 return wmsOnlineResourceProperty.valueAsString( context, wmsOnlineResource );
86 }
87
88 return wmsOnlineResource;
89}
90
92{
93 return project.readEntry( QStringLiteral( "WMSContactOrganization" ), QStringLiteral( "/" ) );
94}
95
97{
98 return project.readEntry( QStringLiteral( "WMSContactPosition" ), QStringLiteral( "/" ) );
99}
100
102{
103 return project.readEntry( QStringLiteral( "WMSContactPerson" ), QStringLiteral( "/" ) );
104}
105
107{
108 return project.readEntry( QStringLiteral( "WMSContactMail" ), QStringLiteral( "/" ) );
109}
110
112{
113 return project.readEntry( QStringLiteral( "WMSContactPhone" ), QStringLiteral( "/" ) );
114}
115
117{
118 return project.readEntry( QStringLiteral( "WMSFees" ), QStringLiteral( "/" ) );
119}
120
122{
123 return project.readEntry( QStringLiteral( "WMSAccessConstraints" ), QStringLiteral( "/" ) );
124}
125
127{
128 return project.readNumEntry( QStringLiteral( "WMSMaxWidth" ), QStringLiteral( "/" ), -1 );
129}
130
132{
133 return project.readNumEntry( QStringLiteral( "WMSMaxHeight" ), QStringLiteral( "/" ), -1 );
134}
135
137{
138 return project.readBoolEntry( QStringLiteral( "WMSUseLayerIDs" ), QStringLiteral( "/" ), false );
139}
140
142{
143 return project.readNumEntry( QStringLiteral( "WMSImageQuality" ), QStringLiteral( "/" ), -1 );
144}
145
147{
148 return project.readNumEntry( QStringLiteral( "WMSTileBuffer" ), QStringLiteral( "/" ), 0 );
149}
150
152{
153 return project.readNumEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), 1 );
154}
155
157{
158 return project.readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 );
159}
160
162{
163 const QString sia2045 = project.readEntry( QStringLiteral( "WMSInfoFormatSIA2045" ), QStringLiteral( "/" ), "" );
164
165 return sia2045.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
166 || sia2045.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
167}
168
170{
171 const QString wktGeom = project.readEntry( QStringLiteral( "WMSAddWktGeometry" ), QStringLiteral( "/" ), "" );
172
173 return wktGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
174 || wktGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
175}
176
178{
179 const QString useFormSettings = project.readEntry( QStringLiteral( "WMSFeatureInfoUseAttributeFormSettings" ), QStringLiteral( "/" ), "" );
180 return useFormSettings.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
181 || useFormSettings.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
182}
183
185{
186 const QString useFormSettings = project.readEntry( QStringLiteral( "WMSHTMLFeatureInfoUseOnlyMaptip" ), QStringLiteral( "/" ), "" );
187 return useFormSettings.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
188}
189
191{
192 const QString segmGeom = project.readEntry( QStringLiteral( "WMSSegmentizeFeatureInfoGeometry" ), QStringLiteral( "/" ), "" );
193
194 return segmGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
195 || segmGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
196}
197
199{
200 const QString legendGroups = project.readEntry( QStringLiteral( "WMSAddLayerGroupsLegendGraphic" ), QStringLiteral( "/" ), "" );
201 return legendGroups.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
202 || legendGroups.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
203}
204
206{
207 return project.readBoolEntry( QStringLiteral( "WMSSkipNameForGroup" ), QStringLiteral( "/" ), false );
208}
209
211{
212 return project.readNumEntry( QStringLiteral( "WMSPrecision" ), QStringLiteral( "/" ), 6 );
213}
214
216{
217 return project.readEntry( QStringLiteral( "WMSFeatureInfoDocumentElement" ), QStringLiteral( "/" ), "" );
218}
219
221{
222 return project.readEntry( QStringLiteral( "WMSFeatureInfoDocumentElementNS" ), QStringLiteral( "/" ), "" );
223}
224
226{
227 return project.readEntry( QStringLiteral( "WMSFeatureInfoSchema" ), QStringLiteral( "/" ), "" );
228}
229
230QHash<QString, QString> QgsServerProjectUtils::wmsFeatureInfoLayerAliasMap( const QgsProject &project )
231{
232 QHash<QString, QString> aliasMap;
233
234 //WMSFeatureInfoAliasLayers
235 const QStringList aliasLayerStringList = project.readListEntry( QStringLiteral( "WMSFeatureInfoAliasLayers" ), QStringLiteral( "/value" ), QStringList() );
236 if ( aliasLayerStringList.isEmpty() )
237 {
238 return aliasMap;
239 }
240
241 //WMSFeatureInfoLayerAliases
242 const QStringList layerAliasStringList = project.readListEntry( QStringLiteral( "WMSFeatureInfoLayerAliases" ), QStringLiteral( "/value" ), QStringList() );
243 if ( layerAliasStringList.isEmpty() )
244 {
245 return aliasMap;
246 }
247
248 const int nMapEntries = std::min( aliasLayerStringList.size(), layerAliasStringList.size() );
249 for ( int i = 0; i < nMapEntries; ++i )
250 {
251 aliasMap.insert( aliasLayerStringList.at( i ), layerAliasStringList.at( i ) );
252 }
253
254 return aliasMap;
255}
256
258{
259 return project.readBoolEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/activated" ) );
260}
261
263{
264 return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/language" ) );
265}
266
268{
269 return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrl" ) );
270}
271
273{
274 return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrlType" ) );
275}
276
278{
279 return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/temporalReference" ) );
280}
281
283{
284 return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataDate" ) );
285}
286
288{
289 return project.readListEntry( QStringLiteral( "WMSRestrictedComposers" ), QStringLiteral( "/" ), QStringList() );
290}
291
293{
294 QStringList crsList;
295 const QStringList wmsCrsList = project.readListEntry( QStringLiteral( "WMSCrsList" ), QStringLiteral( "/" ), QStringList() );
296 if ( !wmsCrsList.isEmpty() )
297 {
298 for ( const auto &crs : std::as_const( wmsCrsList ) )
299 {
300 if ( !crs.isEmpty() )
301 {
302 crsList.append( crs );
303 }
304 }
305 }
306 if ( crsList.isEmpty() )
307 {
308 const QStringList valueList = project.readListEntry( QStringLiteral( "WMSEpsgList" ), QStringLiteral( "/" ), QStringList() );
309 bool conversionOk;
310 for ( const auto &espgStr : valueList )
311 {
312 const int epsgNr = espgStr.toInt( &conversionOk );
313 if ( conversionOk )
314 {
315 crsList.append( QStringLiteral( "EPSG:%1" ).arg( epsgNr ) );
316 }
317 }
318 }
319 if ( crsList.isEmpty() )
320 {
321 //no CRS restriction defined in the project. Provide project CRS, wgs84 and pseudo mercator
322 const QString projectCrsId = project.crs().authid();
323 crsList.append( projectCrsId );
324 if ( projectCrsId.compare( QLatin1String( "EPSG:4326" ), Qt::CaseInsensitive ) != 0 )
325 {
326 crsList.append( QStringLiteral( "EPSG:%1" ).arg( 4326 ) );
327 }
328 if ( projectCrsId.compare( QLatin1String( "EPSG:3857" ), Qt::CaseInsensitive ) != 0 )
329 {
330 crsList.append( QStringLiteral( "EPSG:%1" ).arg( 3857 ) );
331 }
332 }
333 return crsList;
334}
335
337{
338 const QStringList crsList = wmsOutputCrsList( project );
339 QStringList crsListAsOgcUrn;
340 for ( const QString &crsString : crsList )
341 {
342 crsListAsOgcUrn.append( QgsCoordinateReferenceSystem::fromOgcWmsCrs( crsString ).toOgcUrn() );
343 }
344
345 return crsListAsOgcUrn;
346}
347
348QString QgsServerProjectUtils::serviceUrl( const QString &service, const QgsServerRequest &request, const QgsServerSettings &settings )
349{
350 const QString serviceUpper = service.toUpper();
351 QString url = settings.serviceUrl( serviceUpper );
352 if ( !url.isEmpty() )
353 {
354 return url;
355 }
356
358 if ( serviceUpper == QLatin1String( "WMS" ) )
359 {
361 }
362 else if ( serviceUpper == QLatin1String( "WFS" ) )
363 {
365 }
366 else if ( serviceUpper == QLatin1String( "WCS" ) )
367 {
369 }
370 else if ( serviceUpper == QLatin1String( "WMTS" ) )
371 {
373 }
374 url = request.header( header );
375 if ( !url.isEmpty() )
376 {
377 return url;
378 }
380 if ( !url.isEmpty() )
381 {
382 return url;
383 }
384
385 QString proto;
386 QString host;
387
388 QString forwarded = request.header( QgsServerRequest::FORWARDED );
389 if ( !forwarded.isEmpty() )
390 {
391 forwarded = forwarded.split( QLatin1Char( ',' ) )[0];
392 const QStringList elements = forwarded.split( ';' );
393 for ( const QString &element : elements )
394 {
395 QStringList splited_element = element.trimmed().split( QLatin1Char( '=' ) );
396 if ( splited_element[0] == "host" )
397 {
398 host = splited_element[1];
399 }
400 if ( splited_element[0] == "proto" )
401 {
402 proto = splited_element[1];
403 }
404 }
405 }
406
407 if ( host.isEmpty() )
408 {
411 }
412
413 if ( host.isEmpty() )
414 {
416 }
417
418 QUrl urlQUrl = request.baseUrl();
419 if ( !proto.isEmpty() )
420 {
421 urlQUrl.setScheme( proto );
422 }
423
424 if ( !host.isEmpty() )
425 {
426 QStringList hostPort = host.split( QLatin1Char( ':' ) );
427 if ( hostPort.length() == 1 )
428 {
429 urlQUrl.setHost( hostPort[0] );
430 urlQUrl.setPort( -1 );
431 }
432 if ( hostPort.length() == 2 )
433 {
434 urlQUrl.setHost( hostPort[0] );
435 urlQUrl.setPort( hostPort[1].toInt() );
436 }
437 }
438
439 // https://docs.qgis.org/3.16/en/docs/server_manual/services.html#wms-map
440 const QUrlQuery query { request.originalUrl().query() };
441 const QList<QPair<QString, QString>> constItems { query.queryItems() };
442 QString map;
443 for ( const QPair<QString, QString> &item : std::as_const( constItems ) )
444 {
445 if ( 0 == item.first.compare( QLatin1String( "MAP" ), Qt::CaseSensitivity::CaseInsensitive ) )
446 {
447 map = item.second;
448 break;
449 }
450 }
451
452 if ( !map.isEmpty() )
453 {
454 QUrlQuery query;
455 query.setQueryItems( { { "MAP", map } } );
456 urlQUrl.setQuery( query );
457 }
458 else
459 {
460 urlQUrl.setQuery( nullptr );
461 }
462
463 return urlQUrl.url();
464}
465
466QString QgsServerProjectUtils::wmsServiceUrl( const QgsProject &project, const QgsServerRequest &request, const QgsServerSettings &settings )
467{
468 QString url = project.readEntry( QStringLiteral( "WMSUrl" ), QStringLiteral( "/" ), "" );
469 if ( url.isEmpty() )
470 {
471 url = serviceUrl( QStringLiteral( "WMS" ), request, settings );
472 }
473 return url;
474}
475
477{
478 return project.readEntry( QStringLiteral( "WMSRootName" ), QStringLiteral( "/" ), "" );
479}
480
482{
483 return project.readListEntry( QStringLiteral( "WMSRestrictedLayers" ), QStringLiteral( "/" ), QStringList() );
484}
485
487{
488 bool ok = false;
489 QStringList values = project.readListEntry( QStringLiteral( "WMSExtent" ), QStringLiteral( "/" ), QStringList(), &ok );
490 if ( !ok || values.size() != 4 )
491 {
492 return QgsRectangle();
493 }
494 //order of value elements must be xmin, ymin, xmax, ymax
495 const double xmin = values[0].toDouble();
496 const double ymin = values[1].toDouble();
497 const double xmax = values[2].toDouble();
498 const double ymax = values[3].toDouble();
499 return QgsRectangle( xmin, ymin, xmax, ymax );
500}
501
502QString QgsServerProjectUtils::wfsServiceUrl( const QgsProject &project, const QgsServerRequest &request, const QgsServerSettings &settings )
503{
504 QString url = project.readEntry( QStringLiteral( "WFSUrl" ), QStringLiteral( "/" ), "" );
505 if ( url.isEmpty() )
506 {
507 url = serviceUrl( QStringLiteral( "WFS" ), request, settings );
508 }
509 return url;
510}
511
513{
514 return project.readListEntry( QStringLiteral( "WFSLayers" ), QStringLiteral( "/" ) );
515}
516
517int QgsServerProjectUtils::wfsLayerPrecision( const QgsProject &project, const QString &layerId )
518{
519 return project.readNumEntry( QStringLiteral( "WFSLayersPrecision" ), "/" + layerId, 6 );
520}
521
523{
524 return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Update" ) );
525}
526
528{
529 return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Insert" ) );
530}
531
533{
534 return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Delete" ) );
535}
536
537QString QgsServerProjectUtils::wcsServiceUrl( const QgsProject &project, const QgsServerRequest &request, const QgsServerSettings &settings )
538{
539 QString url = project.readEntry( QStringLiteral( "WCSUrl" ), QStringLiteral( "/" ), "" );
540 if ( url.isEmpty() )
541 {
542 url = serviceUrl( QStringLiteral( "WCS" ), request, settings );
543 }
544 return url;
545}
546
548{
549 return project.readListEntry( QStringLiteral( "WCSLayers" ), QStringLiteral( "/" ) );
550}
551
552QString QgsServerProjectUtils::wmtsServiceUrl( const QgsProject &project, const QgsServerRequest &request, const QgsServerSettings &settings )
553{
554 QString url = project.readEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), "" );
555 if ( url.isEmpty() )
556 {
557 url = serviceUrl( QStringLiteral( "WMTS" ), request, settings );
558 }
559 return url;
560}
561
563{
564 return project.readBoolEntry( QStringLiteral( "RenderMapTile" ), QStringLiteral( "/" ), false );
565}
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
QString title
Definition qgsproject.h:112
QgsPropertyCollection dataDefinedServerProperties() const
Returns the data defined properties used for overrides in user defined server parameters.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
Reads a string from the specified scope and key.
bool readBoolEntry(const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const
Reads a boolean from the specified scope and key.
QgsCoordinateReferenceSystem crs
Definition qgsproject.h:115
double readDoubleEntry(const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const
Reads a double from the specified scope and key.
QStringList readListEntry(const QString &scope, const QString &key, const QStringList &def=QStringList(), bool *ok=nullptr) const
Reads a string list from the specified scope and key.
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
A store for object properties.
QString expressionString() const
Returns the expression used for the property value.
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
bool isActive() const
Returns whether the property is currently active.
A rectangle specified with double values.
static QString wmsFeatureInfoSchema(const QgsProject &project)
Returns the schema URL for XML GetFeatureInfo request.
static int wmsTileBuffer(const QgsProject &project)
Returns the tile buffer in pixels for WMS images defined in a QGIS project.
static QString wcsServiceUrl(const QgsProject &project, const QgsServerRequest &request=QgsServerRequest(), const QgsServerSettings &settings=QgsServerSettings())
Returns the WCS service url.
static QString wmsRootName(const QgsProject &project)
Returns the WMS root layer name defined in a QGIS project.
static bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
static bool wmsSkipNameForGroup(const QgsProject &project)
Returns if name attribute should be skipped for groups in WMS capabilities document.
static QString wmsInspireMetadataUrl(const QgsProject &project)
Returns the Inspire metadata URL.
static bool wmsHTMLFeatureInfoUseOnlyMaptip(const QgsProject &project)
Returns if only the maptip should be used for HTML feature info response so that the HTML response to...
static QString wmtsServiceUrl(const QgsProject &project, const QgsServerRequest &request=QgsServerRequest(), const QgsServerSettings &settings=QgsServerSettings())
Returns the WMTS service url.
static int wmsFeatureInfoPrecision(const QgsProject &project)
Returns the geometry precision for GetFeatureInfo request.
static double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
static QString wmsFeatureInfoDocumentElementNs(const QgsProject &project)
Returns the document element namespace for XML GetFeatureInfo request.
static QStringList wmsRestrictedComposers(const QgsProject &project)
Returns the restricted composer list.
static QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
static bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
static bool wmsFeatureInfoSegmentizeWktGeometry(const QgsProject &project)
Returns if the geometry has to be segmentize in GetFeatureInfo request.
static QString owsServiceAccessConstraints(const QgsProject &project)
Returns the owsService access constraints defined in project.
static QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
static bool wmsRenderMapTiles(const QgsProject &project)
Returns true if WMS requests should use the QgsMapSettings::RenderMapTile flag, so that no visible ar...
static QString owsServiceOnlineResource(const QgsProject &project)
Returns the owsService online resource defined in project.
static QString owsServiceFees(const QgsProject &project)
Returns the owsService fees defined in project.
static QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
static QString owsServiceContactPosition(const QgsProject &project)
Returns the owsService contact position defined in project.
static QStringList wfstUpdateLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
static bool wmsFeatureInfoUseAttributeFormSettings(const QgsProject &project)
Returns if feature form settings should be considered for the format of the feature info response.
static QStringList wmsOutputCrsListAsOgcUrn(const QgsProject &project)
Returns the WMS output CRS list as OGC URNs.
static QString serviceUrl(const QString &service, const QgsServerRequest &request, const QgsServerSettings &settings)
Returns the service url defined in the environment variable or with HTTP header.
static QStringList wfstInsertLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
static QString wmsInspireTemporalReference(const QgsProject &project)
Returns the Inspire temporal reference.
static QStringList wmsOutputCrsList(const QgsProject &project)
Returns the WMS output CRS list.
static QString wmsInspireMetadataDate(const QgsProject &project)
Returns the Inspire metadata date.
static QString owsServiceContactOrganization(const QgsProject &project)
Returns the owsService contact organization defined in project.
static QHash< QString, QString > wmsFeatureInfoLayerAliasMap(const QgsProject &project)
Returns the mapping between layer name and wms layer name for GetFeatureInfo request.
static bool wmsFeatureInfoAddWktGeometry(const QgsProject &project)
Returns if the geometry is displayed as Well Known Text in GetFeatureInfo request.
static QString wmsServiceUrl(const QgsProject &project, const QgsServerRequest &request=QgsServerRequest(), const QgsServerSettings &settings=QgsServerSettings())
Returns the WMS service url.
static QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
static int wmsImageQuality(const QgsProject &project)
Returns the quality for WMS images defined in a QGIS project.
static QString wmsInspireLanguage(const QgsProject &project)
Returns the Inspire language.
static QString wmsInspireMetadataUrlType(const QgsProject &project)
Returns the Inspire metadata URL type.
static double wmsDefaultMapUnitsPerMm(const QgsProject &project)
Returns the default number of map units per millimeters in case of the scale is not given.
static bool owsServiceCapabilities(const QgsProject &project)
Returns if owsService capabilities are enabled.
static bool wmsInspireActivate(const QgsProject &project)
Returns if Inspire is activated.
static int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
static QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
static QString owsServiceContactMail(const QgsProject &project)
Returns the owsService contact mail defined in project.
static QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
static double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
static QStringList wfstDeleteLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
static QString wfsServiceUrl(const QgsProject &project, const QgsServerRequest &request=QgsServerRequest(), const QgsServerSettings &settings=QgsServerSettings())
Returns the WFS service url.
static int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.
static QStringList wcsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WCS.
static bool wmsAddLegendGroupsLegendGraphic(const QgsProject &project)
Returns if legend groups should be in the legend graphic response if GetLegendGraphic is called on a ...
static QString wmsFeatureInfoDocumentElement(const QgsProject &project)
Returns the document element name for XML GetFeatureInfo request.
static int wmsMaxAtlasFeatures(const QgsProject &project)
Returns the maximum number of atlas features which can be printed in a request.
static QString owsServiceContactPhone(const QgsProject &project)
Returns the owsService contact phone defined in project.
static int wfsLayerPrecision(const QgsProject &project, const QString &layerId)
Returns the Layer precision defined in a QGIS project for the WFS GetFeature.
static QString owsServiceContactPerson(const QgsProject &project)
Returns the owsService contact person defined in project.
Defines requests passed to QgsService classes.
virtual QString header(const QString &name) const
Returns the header value.
QUrl baseUrl() const
Returns the base URL of QGIS server.
QUrl originalUrl() const
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS s...
RequestHeader
The internal HTTP Header used for the request as enum.
@ X_QGIS_WMS_SERVICE_URL
The QGIS WMS service URL.
@ X_QGIS_WCS_SERVICE_URL
The QGIS WCS service URL.
@ X_QGIS_WFS_SERVICE_URL
The QGIS WFS service URL.
@ X_FORWARDED_PROTO
Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto.
@ X_QGIS_WMTS_SERVICE_URL
The QGIS WMTS service URL.
@ X_QGIS_SERVICE_URL
The QGIS service URL.
@ X_FORWARDED_HOST
Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host.
@ FORWARDED
Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded, https://tools....
@ HOST
Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host.
Provides a way to retrieve settings by prioritizing according to environment variables,...
QString serviceUrl(const QString &service) const
Returns the service URL from the setting.