QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
QgsArcGisRestQueryUtils Class Reference

Utility functions for querying ArcGIS REST services. More...

#include <qgsarcgisrestquery.h>

Classes

struct  LayerItemDetails
 Encapsulates details relating to a layer item. More...

Public Types

enum class  ServiceTypeFilter { Vector = 1 << 0 , Raster = 1 << 1 , Scene = 1 << 2 }
 Service types. More...
typedef QFlags< ServiceTypeFilterServiceTypeFilters

Static Public Member Functions

static void addLayerItems (const std::function< void(const LayerItemDetails &details)> &visitor, const QVariantMap &serviceData, const QString &parentUrl, const QString &parentSupportedFormats, Qgis::ArcGisRestServiceType serviceType)
 Calls the specified visitor function on all layer items found within the given service data.
static QgsRectangle getExtent (const QString &layerurl, const QString &whereClause, const QString &authcfg, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), const QString &urlPrefix=QString())
 Retrieves the extent for the features matching a whereClause.
static QVariantMap getLayerInfo (const QString &layerurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), const QString &urlPrefix=QString())
 Retrieves JSON layer info for the specified layer URL.
static QVariantMap getObjectIds (const QString &layerurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), const QString &urlPrefix=QString(), const QgsRectangle &bbox=QgsRectangle(), const QString &whereClause=QString())
 Retrieves all object IDs for the specified layer URL.
static QList< quint32 > getObjectIdsByExtent (const QString &layerurl, const QgsRectangle &filterRect, QString &errorTitle, QString &errorText, const QString &authcfg, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, const QString &whereClause=QString(), const QString &urlPrefix=QString())
 Gets a list of object IDs which fall within the specified extent.
static QVariantMap getObjects (const QString &layerurl, const QString &authcfg, const QList< quint32 > &objectIds, const QString &crs, bool fetchGeometry, const QStringList &fetchAttributes, bool fetchM, bool fetchZ, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, const QString &urlPrefix=QString())
 Retrieves all matching objects from the specified layer URL.
static QVariantMap getServiceInfo (const QString &baseurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), const QString &urlPrefix=QString(), bool forceRefresh=false)
 Retrieves JSON service info for the specified base URL.
static QUrl parseUrl (const QUrl &url, bool *isTestEndpoint=nullptr)
 Parses and processes a url.
static QByteArray queryService (const QUrl &url, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, QString *contentType=nullptr, const QString &urlPrefix=QString(), bool forceRefresh=false)
 Performs a blocking request to a URL and returns the retrieved data.
static QVariantMap queryServiceJSON (const QUrl &url, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, const QString &urlPrefix=QString(), bool forceRefresh=false)
 Performs a blocking request to a URL and returns the retrieved JSON content.
static Qgis::ArcGisRestServiceType sniffServiceTypeFromJson (const QVariantMap &json)
 Attempts to resolve the service type from a json definition.
static Qgis::ArcGisRestServiceType sniffServiceTypeFromUrl (const QUrl &url)
 Attempts to resolve the service type from a url.
static void visitFolderItems (const std::function< void(const QString &folderName, const QString &url)> &visitor, const QVariantMap &serviceData, const QString &baseUrl)
 Calls the specified visitor function on all folder items found within the given service data.
static void visitServiceItems (const std::function< void(const QString &serviceName, const QString &url, Qgis::ArcGisRestServiceType serviceType)> &visitor, const QVariantMap &serviceData, const QString &baseUrl)
 Calls the specified visitor function on all service items found within the given service data.

Friends

class TestQgsArcGisRestUtils

Detailed Description

Utility functions for querying ArcGIS REST services.

Since
QGIS 3.18

Definition at line 40 of file qgsarcgisrestquery.h.

Member Typedef Documentation

◆ ServiceTypeFilters

Member Enumeration Documentation

◆ ServiceTypeFilter

Service types.

Enumerator
Vector 
Raster 
Scene 

Definition at line 46 of file qgsarcgisrestquery.h.

Member Function Documentation

◆ addLayerItems()

void QgsArcGisRestQueryUtils::addLayerItems ( const std::function< void(const LayerItemDetails &details)> & visitor,
const QVariantMap & serviceData,
const QString & parentUrl,
const QString & parentSupportedFormats,
Qgis::ArcGisRestServiceType serviceType )
static

Calls the specified visitor function on all layer items found within the given service data.

Definition at line 508 of file qgsarcgisrestquery.cpp.

◆ getExtent()

QgsRectangle QgsArcGisRestQueryUtils::getExtent ( const QString & layerurl,
const QString & whereClause,
const QString & authcfg,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
const QString & urlPrefix = QString() )
static

Retrieves the extent for the features matching a whereClause.

Since
QGIS 3.28

Definition at line 188 of file qgsarcgisrestquery.cpp.

◆ getLayerInfo()

QVariantMap QgsArcGisRestQueryUtils::getLayerInfo ( const QString & layerurl,
const QString & authcfg,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
const QString & urlPrefix = QString() )
static

Retrieves JSON layer info for the specified layer URL.

Definition at line 158 of file qgsarcgisrestquery.cpp.

◆ getObjectIds()

QVariantMap QgsArcGisRestQueryUtils::getObjectIds ( const QString & layerurl,
const QString & authcfg,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
const QString & urlPrefix = QString(),
const QgsRectangle & bbox = QgsRectangle(),
const QString & whereClause = QString() )
static

Retrieves all object IDs for the specified layer URL.

Definition at line 168 of file qgsarcgisrestquery.cpp.

◆ getObjectIdsByExtent()

QList< quint32 > QgsArcGisRestQueryUtils::getObjectIdsByExtent ( const QString & layerurl,
const QgsRectangle & filterRect,
QString & errorTitle,
QString & errorText,
const QString & authcfg,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
QgsFeedback * feedback = nullptr,
const QString & whereClause = QString(),
const QString & urlPrefix = QString() )
static

Gets a list of object IDs which fall within the specified extent.

Definition at line 256 of file qgsarcgisrestquery.cpp.

◆ getObjects()

QVariantMap QgsArcGisRestQueryUtils::getObjects ( const QString & layerurl,
const QString & authcfg,
const QList< quint32 > & objectIds,
const QString & crs,
bool fetchGeometry,
const QStringList & fetchAttributes,
bool fetchM,
bool fetchZ,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
QgsFeedback * feedback = nullptr,
const QString & urlPrefix = QString() )
static

Retrieves all matching objects from the specified layer URL.

Parameters
layerurl
authcfg
objectIds
crsoverride CRS for retrieved features. If empty, features will be retrieved in their original CRS (i.e. the original representation from the service). If set, then the service will be asked to transform the features from their original representation to the matching CRS. Since the exact transformation which will be used by the service is unknown, is it highly recommended to leave this argument empty and handle any transformations on the client (QGIS) side instead. The string must be value of the form "auth:code". Only the code portion will be used, and passed to the service as a integer only. It is assumed that the backend has the same CRS definition for the code as the proj database, and if this is not the case then an unexpected transformation will occur.
fetchGeometry
fetchAttributes
fetchM
fetchZ
errorTitle
errorText
requestHeaders
feedback
urlPrefix

Definition at line 209 of file qgsarcgisrestquery.cpp.

◆ getServiceInfo()

QVariantMap QgsArcGisRestQueryUtils::getServiceInfo ( const QString & baseurl,
const QString & authcfg,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
const QString & urlPrefix = QString(),
bool forceRefresh = false )
static

Retrieves JSON service info for the specified base URL.

Definition at line 146 of file qgsarcgisrestquery.cpp.

◆ parseUrl()

QUrl QgsArcGisRestQueryUtils::parseUrl ( const QUrl & url,
bool * isTestEndpoint = nullptr )
static

Parses and processes a url.

Definition at line 372 of file qgsarcgisrestquery.cpp.

◆ queryService()

QByteArray QgsArcGisRestQueryUtils::queryService ( const QUrl & url,
const QString & authcfg,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
QgsFeedback * feedback = nullptr,
QString * contentType = nullptr,
const QString & urlPrefix = QString(),
bool forceRefresh = false )
static

Performs a blocking request to a URL and returns the retrieved data.

Definition at line 294 of file qgsarcgisrestquery.cpp.

◆ queryServiceJSON()

QVariantMap QgsArcGisRestQueryUtils::queryServiceJSON ( const QUrl & url,
const QString & authcfg,
QString & errorTitle,
QString & errorText,
const QgsHttpHeaders & requestHeaders = QgsHttpHeaders(),
QgsFeedback * feedback = nullptr,
const QString & urlPrefix = QString(),
bool forceRefresh = false )
static

Performs a blocking request to a URL and returns the retrieved JSON content.

Definition at line 339 of file qgsarcgisrestquery.cpp.

◆ sniffServiceTypeFromJson()

Qgis::ArcGisRestServiceType QgsArcGisRestQueryUtils::sniffServiceTypeFromJson ( const QVariantMap & json)
static

Attempts to resolve the service type from a json definition.

Definition at line 83 of file qgsarcgisrestquery.cpp.

◆ sniffServiceTypeFromUrl()

Qgis::ArcGisRestServiceType QgsArcGisRestQueryUtils::sniffServiceTypeFromUrl ( const QUrl & url)
static

Attempts to resolve the service type from a url.

This may not be successful, e.g. when the service is sitting behind an internal proxy.

Definition at line 43 of file qgsarcgisrestquery.cpp.

◆ visitFolderItems()

void QgsArcGisRestQueryUtils::visitFolderItems ( const std::function< void(const QString &folderName, const QString &url)> & visitor,
const QVariantMap & serviceData,
const QString & baseUrl )
static

Calls the specified visitor function on all folder items found within the given service data.

Definition at line 446 of file qgsarcgisrestquery.cpp.

◆ visitServiceItems()

void QgsArcGisRestQueryUtils::visitServiceItems ( const std::function< void(const QString &serviceName, const QString &url, Qgis::ArcGisRestServiceType serviceType)> & visitor,
const QVariantMap & serviceData,
const QString & baseUrl )
static

Calls the specified visitor function on all service items found within the given service data.

Definition at line 465 of file qgsarcgisrestquery.cpp.

◆ TestQgsArcGisRestUtils

friend class TestQgsArcGisRestUtils
friend

Definition at line 250 of file qgsarcgisrestquery.h.


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