QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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. More...
 
static 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. More...
 
static json layerExtent (const QgsVectorLayer *layer)
 layerExtent returns json array with [xMin,yMin,xMax,yMax] CRS84 extent for the given layer FIXME: the OpenAPI swagger docs say that it is inverted axis order: West, north, east, south edges of the spatial extent. More...
 
static QgsRectangle parseBbox (const QString &bbox)
 Parses a comma separated bbox into a (possibily empty) QgsRectangle. More...
 
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. More...
 
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. More...
 
static const QVector< QgsMapLayer * > publishedWfsLayers (const QgsProject *project)
 Returns the list of layers accessible to the service for a given project. More...
 
template<typename T >
static const QVector< const T * > publishedWfsLayers (const QgsServerApiContext &context)
 Returns the list of layers of type T accessible to the WFS service for a given project. More...
 
static QString sanitizedFieldValue (const QString &value)
 Sanitizes the input value by removing URL encoding and checking for malicious content. More...
 

Detailed Description

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

Since
QGIS 3.10

Definition at line 49 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 168 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.

Definition at line 145 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 FIXME: the OpenAPI swagger docs say that it is inverted axis order: West, north, east, south edges of the spatial extent.

but current example implementations and GDAL assume it's not. TODO: maybe consider advertised extent instead?

Definition at line 64 of file qgsserverapiutils.cpp.

◆ parseBbox()

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

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

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

Definition at line 31 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 76 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 126 of file qgsserverapiutils.cpp.

◆ publishedWfsLayers() [1/2]

const QVector< QgsMapLayer * > QgsServerApiUtils::publishedWfsLayers ( const QgsProject project)
static

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

Definition at line 94 of file qgsserverapiutils.cpp.

◆ publishedWfsLayers() [2/2]

template<typename T >
static const QVector<const 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<QgsVectorLayer*> vectorLayers = publishedLayers<QgsVectorLayer>();
Note
not available in Python bindings

Definition at line 95 of file qgsserverapiutils.h.

◆ sanitizedFieldValue()

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

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

In case of failure returns an empty string.

Definition at line 115 of file qgsserverapiutils.cpp.


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