Class: QgsServerProjectUtils¶
Contains utility functions to retrieve specific entries from a
QgsProject
.
Added in version 3.0.
Static Methods
Returns the owsService abstract defined in project. |
|
Returns the owsService access constraints defined in project. |
|
Returns if owsService capabilities are enabled. |
|
Returns the owsService contact mail defined in project. |
|
Returns the owsService contact organization defined in project. |
|
Returns the owsService contact person defined in project. |
|
Returns the owsService contact phone defined in project. |
|
Returns the owsService contact position defined in project. |
|
Returns the owsService fees defined in project. |
|
Returns the owsService keywords defined in project. |
|
Returns the owsService online resource defined in project. |
|
Returns the owsService title defined in project. |
|
Returns the service url defined in the environment variable or with HTTP header. |
|
Returns the Layer ids list defined in a QGIS project as published in WCS. |
|
Returns the WCS service url. |
|
Returns the Layer ids list defined in a QGIS project as published in WFS. |
|
Returns the Layer precision defined in a QGIS project for the WFS GetFeature. |
|
Returns the WFS service url. |
|
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities. |
|
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities. |
|
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities. |
|
Returns if legend groups should be in the legend graphic response if GetLegendGraphic is called on a layer group. |
|
Returns the default number of map units per millimeters in case of the scale is not given |
|
Returns the WMS Extent restriction. |
|
Returns if the geometry is displayed as Well Known Text in GetFeatureInfo request. |
|
Returns the document element name for XML GetFeatureInfo request. |
|
Returns the document element namespace for XML GetFeatureInfo request. |
|
Returns the mapping between layer name and wms layer name for GetFeatureInfo request. |
|
Returns the geometry precision for GetFeatureInfo request. |
|
Returns the schema URL for XML GetFeatureInfo request. |
|
Returns if the geometry has to be segmentize in GetFeatureInfo request. |
|
Returns if feature form settings should be considered for the format of the feature info response |
|
Returns the quality for WMS images defined in a QGIS project. |
|
Returns if the info format is SIA20145. |
|
Returns if Inspire is activated. |
|
Returns the Inspire language. |
|
Returns the Inspire metadata date. |
|
Returns the Inspire metadata URL. |
|
Returns the Inspire metadata URL type. |
|
Returns the Inspire temporal reference. |
|
Returns the maximum number of atlas features which can be printed in a request |
|
Returns the maximum height for WMS images defined in a QGIS project. |
|
Returns the maximum width for WMS images defined in a QGIS project. |
|
Returns the WMS output CRS list. |
|
Returns |
|
Returns the restricted composer list. |
|
Returns the restricted layer name list. |
|
Returns the WMS root layer name defined in a QGIS project. |
|
Returns the WMS service url. |
|
Returns if name attribute should be skipped for groups in WMS capabilities document. |
|
Returns the tile buffer in pixels for WMS images defined in a QGIS project. |
|
Returns if layer ids are used as name in WMS. |
|
Returns the WMTS service url. |
- class qgis.server.QgsServerProjectUtils[source]¶
Bases:
object
- static owsServiceAbstract(project: QgsProject) str [source]¶
Returns the owsService abstract defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService abstract if defined in project.
- static owsServiceAccessConstraints(project: QgsProject) str [source]¶
Returns the owsService access constraints defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService access constraints if defined in project.
- static owsServiceCapabilities(project: QgsProject) bool [source]¶
Returns if owsService capabilities are enabled.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if owsService capabilities are enabled.
- static owsServiceContactMail(project: QgsProject) str [source]¶
Returns the owsService contact mail defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService contact mail if defined in project.
- static owsServiceContactOrganization(project: QgsProject) str [source]¶
Returns the owsService contact organization defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService contact organization if defined in project.
- static owsServiceContactPerson(project: QgsProject) str [source]¶
Returns the owsService contact person defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService contact person if defined in project.
- static owsServiceContactPhone(project: QgsProject) str [source]¶
Returns the owsService contact phone defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService contact phone if defined in project.
- static owsServiceContactPosition(project: QgsProject) str [source]¶
Returns the owsService contact position defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService contact position if defined in project.
- static owsServiceFees(project: QgsProject) str [source]¶
Returns the owsService fees defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService fees if defined in project.
- static owsServiceKeywords(project: QgsProject) List[str] [source]¶
Returns the owsService keywords defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the owsService keywords if defined in project.
- static owsServiceOnlineResource(project: QgsProject) str [source]¶
Returns the owsService online resource defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService online resource if defined in project.
- static owsServiceTitle(project: QgsProject) str [source]¶
Returns the owsService title defined in project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the owsService title if defined in project with project title as fallback, “Untitled” otherwise.
- static serviceUrl(service: str | None, request: QgsServerRequest, settings: QgsServerSettings) str [source]¶
Returns the service url defined in the environment variable or with HTTP header. This is calculated from (in order of precedence):
Value defined in the project per service
The
QGIS_SERVER_<service>_SERVICE_URL
environment variableThe
QGIS_SERVER_SERVICE_URL
environment variableThe custom
X-:py:class:`Qgis`-<service>-Service-Url
headerThe custom
X-:py:class:`Qgis`-Service-Url
headerBuild from the standard
Forwarded
headerBuild from the pseudo standard
X-Forwarded-Host
andX-Forwarded-Proto
headersBuild from the standard
Host
header and the server protocolBuild from the server name and the server protocol.
- Parameters:
request (QgsServerRequest) – the request
service (Optional[str]) – the used service
settings (QgsServerSettings) – the server settings
- Return type:
str
- Returns:
url to use for this service
Added in version 3.20.
- static wcsLayerIds(project: QgsProject) List[str] [source]¶
Returns the Layer ids list defined in a QGIS project as published in WCS.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the Layer ids list.
- static wcsServiceUrl(project: QgsProject, request: QgsServerRequest = QgsServerRequest(), settings: QgsServerSettings = QgsServerSettings()) str [source]¶
Returns the WCS service url. The URL defined in the project or if not defined the URL from serviceUrl.
- Parameters:
project (QgsProject) – the QGIS project
request (
QgsServerRequest
= QgsServerRequest()) – the requestsettings (
QgsServerSettings
= QgsServerSettings()) – the server settings
- Return type:
str
- Returns:
url to use for this service
- static wfsLayerIds(project: QgsProject) List[str] [source]¶
Returns the Layer ids list defined in a QGIS project as published in WFS.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the Layer ids list.
- static wfsLayerPrecision(project: QgsProject, layerId: str | None) int [source]¶
Returns the Layer precision defined in a QGIS project for the WFS GetFeature.
- Parameters:
project (QgsProject) – the QGIS project
layerId (Optional[str]) – the layer id in the project
- Return type:
int
- Returns:
the layer precision for WFS GetFeature.
- static wfsServiceUrl(project: QgsProject, request: QgsServerRequest = QgsServerRequest(), settings: QgsServerSettings = QgsServerSettings()) str [source]¶
Returns the WFS service url. The URL defined in the project or if not defined the URL from serviceUrl.
- Parameters:
project (QgsProject) – the QGIS project
request (
QgsServerRequest
= QgsServerRequest()) – the requestsettings (
QgsServerSettings
= QgsServerSettings()) – the server settings
- Return type:
str
- Returns:
url to use for this service
- static wfstDeleteLayerIds(project: QgsProject) List[str] [source]¶
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the Layer ids list.
- static wfstInsertLayerIds(project: QgsProject) List[str] [source]¶
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the Layer ids list.
- static wfstUpdateLayerIds(project: QgsProject) List[str] [source]¶
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the Layer ids list.
- static wmsAddLegendGroupsLegendGraphic(project: QgsProject) bool [source]¶
Returns if legend groups should be in the legend graphic response if GetLegendGraphic is called on a layer group.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if the GetLegendGraphic response has to contain legend groups
- static wmsDefaultMapUnitsPerMm(project: QgsProject) float [source]¶
Returns the default number of map units per millimeters in case of the scale is not given
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
float
- Returns:
the default number of map units per millimeter
Added in version 3.4.
- static wmsExtent(project: QgsProject) QgsRectangle [source]¶
Returns the WMS Extent restriction.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
- Returns:
the WMS Extent restriction.
- static wmsFeatureInfoAddWktGeometry(project: QgsProject) bool [source]¶
Returns if the geometry is displayed as Well Known Text in GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if the geometry is displayed as Well Known Text in GetFeatureInfo request.
- static wmsFeatureInfoDocumentElement(project: QgsProject) str [source]¶
Returns the document element name for XML GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the document element name for XML GetFeatureInfo request.
- static wmsFeatureInfoDocumentElementNs(project: QgsProject) str [source]¶
Returns the document element namespace for XML GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the document element namespace for XML GetFeatureInfo request.
- static wmsFeatureInfoLayerAliasMap(project: QgsProject) Dict[str, str] ¶
Returns the mapping between layer name and wms layer name for GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
Dict[str, str]
- Returns:
the mapping between layer name and wms layer name for GetFeatureInfo request.
- static wmsFeatureInfoPrecision(project: QgsProject) int [source]¶
Returns the geometry precision for GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
the geometry precision for GetFeatureInfo request.
- static wmsFeatureInfoSchema(project: QgsProject) str [source]¶
Returns the schema URL for XML GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the schema URL for XML GetFeatureInfo request.
- static wmsFeatureInfoSegmentizeWktGeometry(project: QgsProject) bool [source]¶
Returns if the geometry has to be segmentize in GetFeatureInfo request.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if the geometry has to be segmentize in GetFeatureInfo request.
- static wmsFeatureInfoUseAttributeFormSettings(project: QgsProject) bool [source]¶
Returns if feature form settings should be considered for the format of the feature info response
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
true if the feature form settings shall be considered for the feature info response
- static wmsImageQuality(project: QgsProject) int [source]¶
Returns the quality for WMS images defined in a QGIS project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
quality if defined in project, -1 otherwise.
- static wmsInfoFormatSia2045(project: QgsProject) bool [source]¶
Returns if the info format is SIA20145.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if the info format is SIA20145.
- static wmsInspireActivate(project: QgsProject) bool [source]¶
Returns if Inspire is activated.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if Inspire is activated.
- static wmsInspireLanguage(project: QgsProject) str [source]¶
Returns the Inspire language.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the Inspire language if defined in project.
- static wmsInspireMetadataDate(project: QgsProject) str [source]¶
Returns the Inspire metadata date.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the Inspire metadata date if defined in project.
- static wmsInspireMetadataUrl(project: QgsProject) str [source]¶
Returns the Inspire metadata URL.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the Inspire metadata URL if defined in project.
- static wmsInspireMetadataUrlType(project: QgsProject) str [source]¶
Returns the Inspire metadata URL type.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the Inspire metadata URL type if defined in project.
- static wmsInspireTemporalReference(project: QgsProject) str [source]¶
Returns the Inspire temporal reference.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
the Inspire temporal reference if defined in project.
- static wmsMaxAtlasFeatures(project: QgsProject) int [source]¶
Returns the maximum number of atlas features which can be printed in a request
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
the number of atlas features
- static wmsMaxHeight(project: QgsProject) int [source]¶
Returns the maximum height for WMS images defined in a QGIS project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
height if defined in project, -1 otherwise.
- static wmsMaxWidth(project: QgsProject) int [source]¶
Returns the maximum width for WMS images defined in a QGIS project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
width if defined in project, -1 otherwise.
- static wmsOutputCrsList(project: QgsProject) List[str] [source]¶
Returns the WMS output CRS list.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the WMS output CRS list.
- static wmsRenderMapTiles(project: QgsProject) bool [source]¶
Returns
True
if WMS requests should use theQgsMapSettings
.RenderMapTile flag, so that no visible artifacts are visible between adjacent tiles.This flag can slow down rendering considerably, so it is only used if the corresponding setting is enabled in the project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
True
if the flag should be used, orFalse
if not.
Added in version 3.18.
- static wmsRestrictedComposers(project: QgsProject) List[str] [source]¶
Returns the restricted composer list.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the restricted composer list if defined in project.
- static wmsRestrictedLayers(project: QgsProject) List[str] [source]¶
Returns the restricted layer name list.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
List[str]
- Returns:
the restricted layer name list if defined in project.
- static wmsRootName(project: QgsProject) str [source]¶
Returns the WMS root layer name defined in a QGIS project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
str
- Returns:
root layer name to use for this service
- static wmsServiceUrl(project: QgsProject, request: QgsServerRequest = QgsServerRequest(), settings: QgsServerSettings = QgsServerSettings()) str [source]¶
Returns the WMS service url. The URL defined in the project or if not defined the URL from serviceUrl.
- Parameters:
project (QgsProject) – the QGIS project
request (
QgsServerRequest
= QgsServerRequest()) – the requestsettings (
QgsServerSettings
= QgsServerSettings()) – the server settings
- Return type:
str
- Returns:
url to use for this service
- static wmsSkipNameForGroup(project: QgsProject) bool [source]¶
Returns if name attribute should be skipped for groups in WMS capabilities document.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if name attribute should be skipped for groups in capabilities
Added in version 3.36.
- static wmsTileBuffer(project: QgsProject) int [source]¶
Returns the tile buffer in pixels for WMS images defined in a QGIS project.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
int
- Returns:
tile buffer if defined in project, 0 otherwise.
Added in version 3.10.
- static wmsUseLayerIds(project: QgsProject) bool [source]¶
Returns if layer ids are used as name in WMS.
- Parameters:
project (QgsProject) – the QGIS project
- Return type:
bool
- Returns:
if layer ids are used as name.
- static wmtsServiceUrl(project: QgsProject, request: QgsServerRequest = QgsServerRequest(), settings: QgsServerSettings = QgsServerSettings()) str [source]¶
Returns the WMTS service url. The URL defined in the project or if not defined the URL from serviceUrl.
- Parameters:
project (QgsProject) – the QGIS project
request (
QgsServerRequest
= QgsServerRequest()) – the requestsettings (
QgsServerSettings
= QgsServerSettings()) – the server settings
- Return type:
str
- Returns:
url to use for this service
Added in version 3.4.