15 #ifndef QGSARCGISRESTQUERY_H
16 #define QGSARCGISRESTQUERY_H
20 #include "qgis_core.h"
25 #include <QVariantMap>
53 static QVariantMap getServiceInfo(
const QString &baseurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QString > &requestHeaders = QMap< QString, QString >() );
58 static QVariantMap getLayerInfo(
const QString &layerurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QString > &requestHeaders = QMap< QString, QString >() );
63 static QVariantMap getObjectIds(
const QString &layerurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QString > &requestHeaders = QMap< QString, QString >(),
69 static QVariantMap getObjects(
const QString &layerurl,
const QString &authcfg,
const QList<quint32> &objectIds,
const QString &
crs,
70 bool fetchGeometry,
const QStringList &fetchAttributes,
bool fetchM,
bool fetchZ,
76 static QList<quint32> getObjectIdsByExtent(
const QString &layerurl,
const QgsRectangle &filterRect, QString &errorTitle, QString &errorText,
const QString &authcfg,
const QgsStringMap &requestHeaders =
QgsStringMap(),
QgsFeedback *feedback =
nullptr );
81 static QByteArray queryService(
const QUrl &url,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsStringMap &requestHeaders =
QgsStringMap(),
QgsFeedback *feedback =
nullptr, QString *contentType =
nullptr );
86 static QVariantMap queryServiceJSON(
const QUrl &url,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsStringMap &requestHeaders =
QgsStringMap(),
QgsFeedback *feedback =
nullptr );
91 static void visitFolderItems(
const std::function<
void (
const QString &folderName,
const QString &url )> &visitor,
const QVariantMap &serviceData,
const QString &baseUrl );
96 static void visitServiceItems(
const std::function<
void (
const QString &serviceName,
const QString &url,
const QString &service, ServiceTypeFilter serviceType )> &visitor,
const QVariantMap &serviceData,
const QString &baseUrl );
101 static void addLayerItems(
const std::function<
void (
const QString &parentLayerId, ServiceTypeFilter serviceType,
QgsWkbTypes::GeometryType geometryType,
const QString &layerId,
const QString &name,
const QString &description,
const QString &url,
bool isParentLayer,
const QString &authid,
const QString &format )> &visitor,
const QVariantMap &serviceData,
const QString &parentUrl,
const QString &parentSupportedFormats,
const ServiceTypeFilter filter = AllTypes );
105 static QUrl parseUrl(
const QUrl &url );
106 static void adjustBaseUrl( QString &baseUrl,
const QString &name );
108 friend class TestQgsArcGisRestUtils;
112 class CORE_EXPORT QgsArcGisAsyncQuery :
public QObject
116 QgsArcGisAsyncQuery( QObject *parent =
nullptr );
117 ~QgsArcGisAsyncQuery()
override;
119 void start(
const QUrl &url,
const QString &authCfg, QByteArray *result,
bool allowCache =
false,
const QgsStringMap &headers =
QgsStringMap() );
122 void failed( QString errorTitle, QString errorName );
127 QNetworkReply *mReply =
nullptr;
128 QByteArray *mResult =
nullptr;
131 class CORE_EXPORT QgsArcGisAsyncParallelQuery :
public QObject
135 QgsArcGisAsyncParallelQuery(
const QString &authcfg,
const QgsStringMap &requestHeaders, QObject *parent =
nullptr );
136 void start(
const QVector<QUrl> &urls, QVector<QByteArray> *results,
bool allowCache =
false );
139 void finished( QStringList errors );
144 QVector<QByteArray> *mResults =
nullptr;
145 int mPendingRequests = 0;
Utility functions for querying ArcGIS REST services.
ServiceTypeFilter
Service types.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A rectangle specified with double values.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
QMap< QString, QString > QgsStringMap
const QgsCoordinateReferenceSystem & crs