QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QgsServerApiUtils Class Reference

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

#include <qgsserverapiutils.h>

Static Public Member Functions

static QString appendMapParameter (const QString &path, const QUrl &requestUrl)
 Appends MAP query string parameter from current requestUrl to the given path.
 
static Q_DECL_DEPRECATED QString crsToOgcUri (const QgsCoordinateReferenceSystem &crs)
 Returns a crs as OGC URI (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) Returns an empty string on failure.
 
static QString fieldName (const QString &name, const QgsVectorLayer *layer)
 Given a field name (or display name) and a layer returns the actual name of the field.
 
static json layerExtent (const QgsVectorLayer *layer)
 layerExtent returns json array with [xMin,yMin,xMax,yMax] CRS84 extent for the given layer
 
static QgsRectangle parseBbox (const QString &bbox)
 Parses a comma separated bbox into a (possibly empty) QgsRectangle.
 
static QgsCoordinateReferenceSystem parseCrs (const QString &bboxCrs)
 Parses the CRS URI bboxCrs (example: "http://www.opengis.net/def/crs/OGC/1.3/CRS84") into a QGIS CRS object.
 
static QgsDateRange parseTemporalDateInterval (const QString &interval)
 Parses a date interval and returns a QgsDateRange.
 
static QgsDateTimeRange parseTemporalDateTimeInterval (const QString &interval)
 Parses a datetime interval and returns a QgsDateTimeRange.
 
static QStringList publishedCrsList (const QgsProject *project)
 Returns the list of CRSs (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) available for this project.
 
static const QVector< QgsVectorLayer * > publishedWfsLayers (const QgsServerApiContext &context)
 Returns the list of layers accessible to the service for a given context.
 
template<typename T >
static const QVector< T > publishedWfsLayers (const QgsServerApiContext &context)
 Returns the list of layers of type T accessible to the WFS service for a given project.
 
static QString sanitizedFieldValue (const QString &value)
 Sanitizes the input value by removing URL encoding.
 
static QList< QgsServerWmsDimensionProperties::WmsDimensionInfotemporalDimensions (const QgsVectorLayer *layer)
 Returns a list of temporal dimensions information for the given layer (either configured in wmsDimensions or the first date/datetime field)
 
static json temporalExtent (const QgsVectorLayer *layer)
 temporalExtent returns a json array with an array of [min, max] temporal extent for the given layer.
 
static QVariantList temporalExtentList (const QgsVectorLayer *layer)
 temporalExtent returns a json array with an array of [min, max] temporal extent for the given layer.
 
static QgsExpression temporalFilterExpression (const QgsVectorLayer *layer, const QString &interval)
 Parses the interval and constructs a (possibly invalid) temporal filter expression for the given layer.
 

Detailed Description

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

Since
QGIS 3.10

Definition at line 53 of file qgsserverapiutils.h.

Member Function Documentation

◆ appendMapParameter()

QString QgsServerApiUtils::appendMapParameter ( const QString &  path,
const QUrl &  requestUrl 
)
static

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

Definition at line 578 of file qgsserverapiutils.cpp.

◆ crsToOgcUri()

QString QgsServerApiUtils::crsToOgcUri ( const QgsCoordinateReferenceSystem crs)
static

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

Deprecated:
QGIS 3.30. Use QgsCoordinateReferenceSystem::toOgcUri() instead.

Definition at line 573 of file qgsserverapiutils.cpp.

◆ fieldName()

QString QgsServerApiUtils::fieldName ( const QString &  name,
const QgsVectorLayer layer 
)
static

Given a field name (or display name) and a layer returns the actual name of the field.

Exceptions
QgsServerApiBadRequestExceptionif name is neither a field name or a display name.
Since
QGIS 3.28

Definition at line 531 of file qgsserverapiutils.cpp.

◆ layerExtent()

json QgsServerApiUtils::layerExtent ( const QgsVectorLayer layer)
static

layerExtent returns json array with [xMin,yMin,xMax,yMax] CRS84 extent for the given layer

Definition at line 393 of file qgsserverapiutils.cpp.

◆ parseBbox()

QgsRectangle QgsServerApiUtils::parseBbox ( const QString &  bbox)
static

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

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

Definition at line 33 of file qgsserverapiutils.cpp.

◆ parseCrs()

QgsCoordinateReferenceSystem QgsServerApiUtils::parseCrs ( const QString &  bboxCrs)
static

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

Definition at line 509 of file qgsserverapiutils.cpp.

◆ parseTemporalDateInterval()

QgsDateRange QgsServerApiUtils::parseTemporalDateInterval ( const QString &  interval)
static

Parses a date interval and returns a QgsDateRange.

Exceptions
QgsServerApiBadRequestExceptionif interval cannot be parsed
Since
QGIS 3.12

Definition at line 125 of file qgsserverapiutils.cpp.

◆ parseTemporalDateTimeInterval()

QgsDateTimeRange QgsServerApiUtils::parseTemporalDateTimeInterval ( const QString &  interval)
static

Parses a datetime interval and returns a QgsDateTimeRange.

Exceptions
QgsServerApiBadRequestExceptionif interval cannot be parsed
Since
QGIS 3.12

Definition at line 130 of file qgsserverapiutils.cpp.

◆ publishedCrsList()

QStringList QgsServerApiUtils::publishedCrsList ( const QgsProject project)
static

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.

Definition at line 554 of file qgsserverapiutils.cpp.

◆ publishedWfsLayers() [1/2]

const QVector< QgsVectorLayer * > QgsServerApiUtils::publishedWfsLayers ( const QgsServerApiContext context)
static

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.

Definition at line 526 of file qgsserverapiutils.cpp.

◆ publishedWfsLayers() [2/2]

template<typename T >
static const QVector< T > QgsServerApiUtils::publishedWfsLayers ( const QgsServerApiContext context)
inlinestatic

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

Example:

QVector<const QgsVectorLayer*> vectorLayers = publishedLayers<QgsVectorLayer>();
Note
not available in Python bindings

Definition at line 179 of file qgsserverapiutils.h.

◆ sanitizedFieldValue()

QString QgsServerApiUtils::sanitizedFieldValue ( const QString &  value)
static

Sanitizes the input value by removing URL encoding.

Note
the returned value is meant to become part of a QgsExpression filter

Definition at line 548 of file qgsserverapiutils.cpp.

◆ temporalDimensions()

QList< QgsMapLayerServerProperties::WmsDimensionInfo > QgsServerApiUtils::temporalDimensions ( const QgsVectorLayer layer)
static

Returns a list of temporal dimensions information for the given layer (either configured in wmsDimensions or the first date/datetime field)

Since
QGIS 3.12

Definition at line 63 of file qgsserverapiutils.cpp.

◆ temporalExtent()

json QgsServerApiUtils::temporalExtent ( const QgsVectorLayer layer)
static

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.

Returns
An array of intervals
Note
not available in Python bindings
Since
QGIS 3.12

Definition at line 405 of file qgsserverapiutils.cpp.

◆ temporalExtentList()

QVariantList QgsServerApiUtils::temporalExtentList ( const QgsVectorLayer layer)
static

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.

Returns
An array of intervals
Since
QGIS 3.12

Definition at line 502 of file qgsserverapiutils.cpp.

◆ temporalFilterExpression()

QgsExpression QgsServerApiUtils::temporalFilterExpression ( const QgsVectorLayer layer,
const QString &  interval 
)
static

Parses the interval and constructs a (possibly invalid) temporal filter expression for the given layer.

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

Since
QGIS 3.12

Definition at line 135 of file qgsserverapiutils.cpp.


The documentation for this class was generated from the following files: