Class: QgsServerApiUtils¶
- class qgis.server.QgsServerApiUtils¶
Bases:
sip.wrapper
The
QgsServerApiUtils
class contains helper functions to handle common API operations.New in version 3.10:
Methods
Appends MAP query string parameter from current
requestUrl
to the givenpath
Returns a
crs
as OGC URI (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) Returns an empty string on failure.Parses a comma separated
bbox
into a (possibly empty)QgsRectangle
.Parses the CRS URI
bboxCrs
(example: "http://www.opengis.net/def/crs/OGC/1.3/CRS84") into a QGIS CRS objectParses a date
interval
and returns aQgsDateRange
Parses a datetime
interval
and returns aQgsDateTimeRange
Returns the list of CRSs (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) available for this
project
.Returns the list of layers accessible to the service for a given
context
.Sanitizes the input
value
by removing URL encoding.Returns a list of temporal dimensions information for the given
layer
(either configured in wmsDimensions or the first date/datetime field)temporalExtent returns a json array with an array of [min, max] temporal extent for the given
layer
.Parses the
interval
and constructs a (possibly invalid) temporal filter expression for the givenlayer
- appendMapParameter(path: str, requestUrl: QUrl) str ¶
Appends MAP query string parameter from current
requestUrl
to the givenpath
- 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 (possibly empty)QgsRectangle
.Note
Z values (i.e. a 6 elements bbox) are silently discarded
- Parameters
bbox (str) –
- Return type
- 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
- parseTemporalDateInterval(interval: str) QgsDateRange ¶
Parses a date
interval
and returns aQgsDateRange
- Raises
QgsServerApiBadRequestException – if interval cannot be parsed
New in version 3.12.
- Parameters
interval (str) –
- Return type
- parseTemporalDateTimeInterval(interval: str) QgsDateTimeRange ¶
Parses a datetime
interval
and returns aQgsDateTimeRange
- Raises
QgsServerApiBadRequestException – if interval cannot be parsed
New in version 3.12.
- Parameters
interval (str) –
- Return type
- 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(context: QgsServerApiContext) object ¶
Returns the list of layers accessible to the service for a given
context
.This method takes into account the ACL restrictions provided by QGIS Server Access Control plugins.
- Parameters
context (QgsServerApiContext) –
- Return type
object
- sanitizedFieldValue(value: str) str ¶
Sanitizes the input
value
by removing URL encoding.Note
the returned value is meant to become part of a
QgsExpression
filter- Parameters
value (str) –
- Return type
str
- temporalDimensions(layer: QgsVectorLayer) List[QgsServerWmsDimensionProperties.WmsDimensionInfo] ¶
Returns a list of temporal dimensions information for the given
layer
(either configured in wmsDimensions or the first date/datetime field)New in version 3.12.
- Parameters
layer (QgsVectorLayer) –
- Return type
- temporalExtent(layer: QgsVectorLayer) List[Any] ¶
temporalExtent returns a json array with an array of [min, max] temporal extent for the given
layer
. In case multiple temporal dimensions are available in the layer, a union of all dimensions is returned.From specifications: http://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/extent.yaml
One or more time intervals that describe the temporal extent of the dataset. The value null is supported and indicates an open time interval.
In the Core only a single time interval is supported. Extensions may support multiple intervals. If multiple intervals are provided, the union of the intervals describes the temporal extent.
- Return type
List[Any]
- Returns
An array of intervals
New in version 3.12.
- Parameters
layer (QgsVectorLayer) –
- temporalFilterExpression(layer: QgsVectorLayer, interval: str) QgsExpression ¶
Parses the
interval
and constructs a (possibly invalid) temporal filter expression for the givenlayer
Interval syntax:
interval-closed = date-time “/” date-time interval-open-start = [“..”] “/” date-time interval-open-end = date-time “/” [“..”] interval = interval-closed / interval-open-start / interval-open-end datetime = date-time / interval
New in version 3.12.
- Parameters
layer (QgsVectorLayer) –
interval (str) –
- Return type