Class: QgsServerApiUtils

class qgis.server.QgsServerApiUtils

Bases: sip.wrapper

The QgsServerApiUtils class contains helper functions to handle common API operations.

Methods

appendMapParameter

Appends MAP query string parameter from current requestUrl to the given path

crsToOgcUri

Returns a crs as OGC URI (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) Returns an empty string on failure.

parseBbox

Parses a comma separated bbox into a (possibily empty) QgsRectangle.

parseCrs

Parses the CRS URI bboxCrs (example: “http://www.opengis.net/def/crs/OGC/1.3/CRS84”) into a QGIS CRS object

publishedCrsList

Returns the list of CRSs (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) available for this project.

publishedWfsLayers

Returns the list of layers accessible to the service for a given project.

sanitizedFieldValue

Sanitizes the input value by removing URL encoding and checking for malicious content.

appendMapParameter(path: str, requestUrl: QUrl) → str

Appends MAP query string parameter from current requestUrl to the given path

Parameters
  • path (str) –

  • requestUrl (QUrl) –

Return type

str

crsToOgcUri(crs: QgsCoordinateReferenceSystem) → str

Returns a crs as OGC URI (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) Returns an empty string on failure.

Parameters

crs (QgsCoordinateReferenceSystem) –

Return type

str

parseBbox(bbox: str)QgsRectangle

Parses a comma separated bbox into a (possibily empty) QgsRectangle.

Note

Z values (i.e. a 6 elements bbox) are silently discarded

Parameters

bbox (str) –

Return type

QgsRectangle

parseCrs(bboxCrs: str)QgsCoordinateReferenceSystem

Parses the CRS URI bboxCrs (example: “http://www.opengis.net/def/crs/OGC/1.3/CRS84”) into a QGIS CRS object

Parameters

bboxCrs (str) –

Return type

QgsCoordinateReferenceSystem

publishedCrsList(project: QgsProject) → List[str]

Returns the list of CRSs (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) available for this project. Information is read from project WMS configuration.

Parameters

project (QgsProject) –

Return type

List[str]

publishedWfsLayers(project: QgsProject) → object

Returns the list of layers accessible to the service for a given project.

This method takes into account the ACL restrictions provided by QGIS Server Access Control plugins.

Note

project must not be NULL

Parameters

project (QgsProject) –

Return type

object

sanitizedFieldValue(value: str) → str

Sanitizes the input value by removing URL encoding and checking for malicious content. In case of failure returns an empty string.

Parameters

value (str) –

Return type

str