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

Utility functions for working with ArcGIS REST services. More...

#include <qgsarcgisrestutils.h>

Public Types

enum class  FeatureToJsonFlag : int { IncludeGeometry = 1 << 0 , IncludeNonObjectIdAttributes = 1 << 1 , SkipUnsetAttributes = 1 << 2 }
 Flags which control the behavior of converting features to JSON. More...
typedef QFlags< FeatureToJsonFlagFeatureToJsonFlags
 Flags which control the behavior of converting features to JSON.

Public Member Functions

 Q_ENUM (FeatureToJsonFlag)

Static Public Member Functions

static Qgis::RasterColorInterpretation colorInterpretationFromBandName (const QString &bandName)
 Attempts to match arbitrary band name strings to a QGIS raster color interpretation.
static QColor convertColor (const QVariant &data)
 Converts ESRI JSON color data to a QColor object.
static QDateTime convertDateTime (const QVariant &value)
 Converts a date time value to a QDateTime.
static QMetaType::Type convertFieldType (const QString &type)
 Converts an ESRI REST field type to a QVariant type.
static Qt::BrushStyle convertFillStyle (const QString &style)
 Converts an ESRI fill style to a Qt brush style.
static std::unique_ptr< QgsAbstractGeometryconvertGeometry (const QVariantMap &geometry, const QString &esriGeometryType, bool hasM, bool hasZ, bool allowCurves=true, QgsCoordinateReferenceSystem *crs=nullptr)
 Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.
static Qgis::WkbType convertGeometryType (const QString &type)
 Converts an ESRI REST geometry type to a WKB type.
static std::unique_ptr< QgsAbstractVectorLayerLabelingconvertLabeling (const QVariantList &data)
 Converts labeling JSON data to an equivalent QGIS vector labeling.
static QString convertLabelingExpression (const QString &string)
 Converts an ESRI labeling expression to a QGIS expression string.
static Qt::PenStyle convertLineStyle (const QString &style)
 Converts an ESRI line style to a Qt pen style.
static QgsRectangle convertRectangle (const QVariant &value)
 Converts a rectangle value to a QgsRectangle.
static std::unique_ptr< QgsFeatureRendererconvertRenderer (const QVariantMap &rendererData)
 Converts renderer JSON data to an equivalent QgsFeatureRenderer.
static QgsCoordinateReferenceSystem convertSpatialReference (const QVariantMap &spatialReferenceMap)
 Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
static std::unique_ptr< QgsSymbolconvertSymbol (const QVariantMap &definition)
 Converts a symbol JSON definition to a QgsSymbol.
static QVariantMap crsToJson (const QgsCoordinateReferenceSystem &crs)
 Converts a crs to an ArcGIS REST JSON representation.
static Qgis::DataType dataTypeFromString (const QString &pixelType)
 Returns the raster data type corresponding to an ESRI pixelType string.
static double defaultNoDataForDataType (Qgis::DataType type, bool &ok)
 Returns a sensible no-data value to use for the specified data type.
static QVariantMap featureToJson (const QgsFeature &feature, const QgsArcGisRestContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), QgsArcGisRestUtils::FeatureToJsonFlags flags=QgsArcGisRestUtils::FeatureToJsonFlags(static_cast< int >(QgsArcGisRestUtils::FeatureToJsonFlag::IncludeGeometry)|static_cast< int >(QgsArcGisRestUtils::FeatureToJsonFlag::IncludeNonObjectIdAttributes)))
 Converts a feature to an ArcGIS REST JSON representation.
static QVariantMap fieldDefinitionToJson (const QgsField &field)
 Converts a field's definition to an ArcGIS REST JSON representation.
static QVariantMap geometryToJson (const QgsGeometry &geometry, const QgsArcGisRestContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Converts a geometry to an ArcGIS REST JSON representation.
static Qgis::ArcGisRestServiceCapabilities serviceCapabilitiesFromString (const QString &capabilities)
 Parses a capabilities string to known values.
static Qgis::ArcGisRestServiceType serviceTypeFromString (const QString &type)
 Converts a string value to a REST service type.
static QVariant variantToAttributeValue (const QVariant &variant, QMetaType::Type expectedType, const QgsArcGisRestContext &context)
 Converts a variant to a REST attribute value.

Friends

class TestQgsArcGisRestUtils

Detailed Description

Utility functions for working with ArcGIS REST services.

See also
QgsArcGisPortalUtils
Since
QGIS 3.18

Definition at line 110 of file qgsarcgisrestutils.h.

Member Typedef Documentation

◆ FeatureToJsonFlags

Flags which control the behavior of converting features to JSON.

Since
QGIS 3.28

Definition at line 239 of file qgsarcgisrestutils.h.

Member Enumeration Documentation

◆ FeatureToJsonFlag

enum class QgsArcGisRestUtils::FeatureToJsonFlag : int
strong

Flags which control the behavior of converting features to JSON.

Since
QGIS 3.28
Enumerator
IncludeGeometry 

Whether to include the geometry definition.

IncludeNonObjectIdAttributes 

Whether to include any non-objectId attributes.

SkipUnsetAttributes 

Skip unset attributes.

Since
QGIS 3.44

Definition at line 226 of file qgsarcgisrestutils.h.

Member Function Documentation

◆ colorInterpretationFromBandName()

Qgis::RasterColorInterpretation QgsArcGisRestUtils::colorInterpretationFromBandName ( const QString & bandName)
static

Attempts to match arbitrary band name strings to a QGIS raster color interpretation.

Since band names are free-form strings, this is a best-effort translation only.

Since
QGIS 4.2

Definition at line 1781 of file qgsarcgisrestutils.cpp.

◆ convertColor()

QColor QgsArcGisRestUtils::convertColor ( const QVariant & data)
static

Converts ESRI JSON color data to a QColor object.

Definition at line 1010 of file qgsarcgisrestutils.cpp.

◆ convertDateTime()

QDateTime QgsArcGisRestUtils::convertDateTime ( const QVariant & value)
static

Converts a date time value to a QDateTime.

Definition at line 1025 of file qgsarcgisrestutils.cpp.

◆ convertFieldType()

QMetaType::Type QgsArcGisRestUtils::convertFieldType ( const QString & type)
static

Converts an ESRI REST field type to a QVariant type.

Definition at line 60 of file qgsarcgisrestutils.cpp.

◆ convertFillStyle()

Qt::BrushStyle QgsArcGisRestUtils::convertFillStyle ( const QString & style)
static

Converts an ESRI fill style to a Qt brush style.

Definition at line 1020 of file qgsarcgisrestutils.cpp.

◆ convertGeometry()

std::unique_ptr< QgsAbstractGeometry > QgsArcGisRestUtils::convertGeometry ( const QVariantMap & geometry,
const QString & esriGeometryType,
bool hasM,
bool hasZ,
bool allowCurves = true,
QgsCoordinateReferenceSystem * crs = nullptr )
static

Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.

Caller takes ownership of the returned object.

Parameters
geometryJSON geometry definition
esriGeometryTypeESRI geometry type string
hasMset to true to if geometry includes M values
hasZset to true to if geometry includes Z values
allowCurvescontrols whether the returned geometry can be a curved geometry type (since QGIS 4.0)
crsif specified will be set to the parsed geometry CRS
Returns
converted geometry

Definition at line 554 of file qgsarcgisrestutils.cpp.

◆ convertGeometryType()

Qgis::WkbType QgsArcGisRestUtils::convertGeometryType ( const QString & type)
static

Converts an ESRI REST geometry type to a WKB type.

Definition at line 91 of file qgsarcgisrestutils.cpp.

◆ convertLabeling()

std::unique_ptr< QgsAbstractVectorLayerLabeling > QgsArcGisRestUtils::convertLabeling ( const QVariantList & data)
static

Converts labeling JSON data to an equivalent QGIS vector labeling.

Caller takes ownership of the returned object.

Definition at line 636 of file qgsarcgisrestutils.cpp.

◆ convertLabelingExpression()

QString QgsArcGisRestUtils::convertLabelingExpression ( const QString & string)
static

Converts an ESRI labeling expression to a QGIS expression string.

Definition at line 986 of file qgsarcgisrestutils.cpp.

◆ convertLineStyle()

Qt::PenStyle QgsArcGisRestUtils::convertLineStyle ( const QString & style)
static

Converts an ESRI line style to a Qt pen style.

Definition at line 1015 of file qgsarcgisrestutils.cpp.

◆ convertRectangle()

QgsRectangle QgsArcGisRestUtils::convertRectangle ( const QVariant & value)
static

Converts a rectangle value to a QgsRectangle.

Returns a null rectangle if the value cannot be converted.

Since
QGIS 3.34

Definition at line 1040 of file qgsarcgisrestutils.cpp.

◆ convertRenderer()

std::unique_ptr< QgsFeatureRenderer > QgsArcGisRestUtils::convertRenderer ( const QVariantMap & rendererData)
static

Converts renderer JSON data to an equivalent QgsFeatureRenderer.

Caller takes ownership of the returned renderer.

Definition at line 765 of file qgsarcgisrestutils.cpp.

◆ convertSpatialReference()

QgsCoordinateReferenceSystem QgsArcGisRestUtils::convertSpatialReference ( const QVariantMap & spatialReferenceMap)
static

Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.

Definition at line 595 of file qgsarcgisrestutils.cpp.

◆ convertSymbol()

std::unique_ptr< QgsSymbol > QgsArcGisRestUtils::convertSymbol ( const QVariantMap & definition)
static

Converts a symbol JSON definition to a QgsSymbol.

Caller takes ownership of the returned symbol.

Definition at line 629 of file qgsarcgisrestutils.cpp.

◆ crsToJson()

QVariantMap QgsArcGisRestUtils::crsToJson ( const QgsCoordinateReferenceSystem & crs)
static

Converts a crs to an ArcGIS REST JSON representation.

Returns an empty map if the crs is not valid.

Since
QGIS 3.28

Definition at line 1543 of file qgsarcgisrestutils.cpp.

◆ dataTypeFromString()

Qgis::DataType QgsArcGisRestUtils::dataTypeFromString ( const QString & pixelType)
static

Returns the raster data type corresponding to an ESRI pixelType string.

Since
QGIS 4.2

Definition at line 1726 of file qgsarcgisrestutils.cpp.

◆ defaultNoDataForDataType()

double QgsArcGisRestUtils::defaultNoDataForDataType ( Qgis::DataType type,
bool & ok )
static

Returns a sensible no-data value to use for the specified data type.

Parameters
typedata type
okwill be set to true if there IS a sensible nodata value for the specified type
Returns
suggested nodata value, if one exists
Since
QGIS 4.2

Definition at line 1833 of file qgsarcgisrestutils.cpp.

◆ featureToJson()

QVariantMap QgsArcGisRestUtils::featureToJson ( const QgsFeature & feature,
const QgsArcGisRestContext & context,
const QgsCoordinateReferenceSystem & crs = QgsCoordinateReferenceSystem(),
QgsArcGisRestUtils::FeatureToJsonFlags flags = QgsArcGisRestUtils::FeatureToJsonFlags(        static_cast< int >( QgsArcGisRestUtils::FeatureToJsonFlag::IncludeGeometry ) | static_cast< int >( QgsArcGisRestUtils::FeatureToJsonFlag::IncludeNonObjectIdAttributes )      ) )
static

Converts a feature to an ArcGIS REST JSON representation.

Since
QGIS 3.28

Definition at line 1568 of file qgsarcgisrestutils.cpp.

◆ fieldDefinitionToJson()

QVariantMap QgsArcGisRestUtils::fieldDefinitionToJson ( const QgsField & field)
static

Converts a field's definition to an ArcGIS REST JSON representation.

Since
QGIS 3.28

Definition at line 1637 of file qgsarcgisrestutils.cpp.

◆ geometryToJson()

QVariantMap QgsArcGisRestUtils::geometryToJson ( const QgsGeometry & geometry,
const QgsArcGisRestContext & context,
const QgsCoordinateReferenceSystem & crs = QgsCoordinateReferenceSystem() )
static

Converts a geometry to an ArcGIS REST JSON representation.

Returns an empty map if the geometry cannot be converted.

Since
QGIS 3.28

Definition at line 1071 of file qgsarcgisrestutils.cpp.

◆ Q_ENUM()

QgsArcGisRestUtils::Q_ENUM ( FeatureToJsonFlag )

◆ serviceCapabilitiesFromString()

Qgis::ArcGisRestServiceCapabilities QgsArcGisRestUtils::serviceCapabilitiesFromString ( const QString & capabilities)
static

Parses a capabilities string to known values.

Since
QGIS 4.2

Definition at line 1710 of file qgsarcgisrestutils.cpp.

◆ serviceTypeFromString()

Qgis::ArcGisRestServiceType QgsArcGisRestUtils::serviceTypeFromString ( const QString & type)
static

Converts a string value to a REST service type.

Since
QGIS 3.28

Definition at line 1690 of file qgsarcgisrestutils.cpp.

◆ variantToAttributeValue()

QVariant QgsArcGisRestUtils::variantToAttributeValue ( const QVariant & variant,
QMetaType::Type expectedType,
const QgsArcGisRestContext & context )
static

Converts a variant to a REST attribute value.

Since
QGIS 3.28

Definition at line 1599 of file qgsarcgisrestutils.cpp.

◆ TestQgsArcGisRestUtils

friend class TestQgsArcGisRestUtils
friend

Definition at line 379 of file qgsarcgisrestutils.h.


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