Class: QgsArcGisRestUtils

class qgis.core.QgsArcGisRestUtils

Bases: sip.wrapper

Utility functions for working with ArcGIS REST services.

New in version 3.18:

Enums

FeatureToJsonFlag

Bases: enum.IntEnum

Methods

convertColor

Converts ESRI JSON color data to a QColor object.

convertDateTime

Converts a date time value to a QDateTime.

convertFieldType

Converts an ESRI REST field type to a QVariant type.

convertFillStyle

Converts an ESRI fill style to a Qt brush style.

convertGeometry

Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.

convertGeometryType

Converts an ESRI REST geometry type to a WKB type.

convertLabeling

Converts labeling JSON data to an equivalent QGIS vector labeling.

convertLabelingExpression

Converts an ESRI labeling expression to a QGIS expression string.

convertLineStyle

Converts an ESRI line style to a Qt pen style.

convertRectangle

Converts a rectangle value to a QgsRectangle.

convertRenderer

Converts renderer JSON data to an equivalent QgsFeatureRenderer.

convertSpatialReference

Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.

convertSymbol

Converts a symbol JSON definition to a QgsSymbol.

crsToJson

Converts a crs to an ArcGIS REST JSON representation.

featureToJson

Converts a feature to an ArcGIS REST JSON representation.

fieldDefinitionToJson

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

geometryToJson

Converts a geometry to an ArcGIS REST JSON representation.

serviceTypeFromString

Converts a string value to a REST service type.

variantToAttributeValue

Converts a variant to a REST attribute value.

Attributes

staticMetaObject

class FeatureToJsonFlag(value)

Bases: enum.IntEnum

Flags which control the behavior of converting features to JSON.

New in version 3.28.

  • IncludeGeometry: Whether to include the geometry definition

  • IncludeNonObjectIdAttributes: Whether to include any non-objectId attributes

IncludeGeometry = 1
IncludeNonObjectIdAttributes = 2
baseClass

alias of QgsArcGisRestUtils

class FeatureToJsonFlags
class FeatureToJsonFlags(Union[QgsArcGisRestUtils.FeatureToJsonFlags, QgsArcGisRestUtils.FeatureToJsonFlag])
class FeatureToJsonFlags(QgsArcGisRestUtils.FeatureToJsonFlags)

Bases: sip.wrapper

baseClass

alias of QgsArcGisRestUtils

convertColor(data: Any) QColor

Converts ESRI JSON color data to a QColor object.

Parameters:

data (Any) –

Return type:

QColor

convertDateTime(value: Any) QDateTime

Converts a date time value to a QDateTime.

Parameters:

value (Any) –

Return type:

QDateTime

convertFieldType(type: str) QVariant.Type

Converts an ESRI REST field type to a QVariant type.

Parameters:

type (str) –

Return type:

QVariant.Type

convertFillStyle(style: str) Qt.BrushStyle

Converts an ESRI fill style to a Qt brush style.

Parameters:

style (str) –

Return type:

Qt.BrushStyle

convertGeometry(geometry: Dict[str, Any], esriGeometryType: str, hasM: bool, hasZ: bool) Tuple[QgsAbstractGeometry, QgsCoordinateReferenceSystem]

Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.

Caller takes ownership of the returned object.

Parameters:
  • geometry (Dict[str) – JSON geometry definition

  • esriGeometryType (str) – ESRI geometry type string

  • hasM (bool) – set to True to if geometry includes M values

  • hasZ (bool) – set to True to if geometry includes Z values

Return type:

Tuple[QgsAbstractGeometry, QgsCoordinateReferenceSystem]

Returns:

  • converted geometry

  • crs: will be set to the parsed geometry CRS

convertGeometryType(type: str) Qgis.WkbType

Converts an ESRI REST geometry type to a WKB type.

Parameters:

type (str) –

Return type:

Qgis.WkbType

convertLabeling(data: Iterable[Any]) QgsAbstractVectorLayerLabeling

Converts labeling JSON data to an equivalent QGIS vector labeling.

Caller takes ownership of the returned object.

Parameters:

data (Iterable[Any]) –

Return type:

QgsAbstractVectorLayerLabeling

convertLabelingExpression(string: str) str

Converts an ESRI labeling expression to a QGIS expression string.

Parameters:

string (str) –

Return type:

str

convertLineStyle(style: str) Qt.PenStyle

Converts an ESRI line style to a Qt pen style.

Parameters:

style (str) –

Return type:

Qt.PenStyle

convertRectangle(value: Any) QgsRectangle

Converts a rectangle value to a QgsRectangle.

Returns a null rectangle if the value cannot be converted.

New in version 3.34.

Parameters:

value (Any) –

Return type:

QgsRectangle

convertRenderer(rendererData: Dict[str, Any]) QgsFeatureRenderer

Converts renderer JSON data to an equivalent QgsFeatureRenderer.

Caller takes ownership of the returned renderer.

Parameters:

rendererData (Dict[str) –

Return type:

QgsFeatureRenderer

convertSpatialReference(spatialReferenceMap: Dict[str, Any]) QgsCoordinateReferenceSystem

Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.

Parameters:

spatialReferenceMap (Dict[str) –

Return type:

QgsCoordinateReferenceSystem

convertSymbol(definition: Dict[str, Any]) QgsSymbol

Converts a symbol JSON definition to a QgsSymbol.

Caller takes ownership of the returned symbol.

Parameters:

definition (Dict[str) –

Return type:

QgsSymbol

crsToJson(crs: QgsCoordinateReferenceSystem) Dict[str, Any]

Converts a crs to an ArcGIS REST JSON representation.

Returns an empty map if the crs is not valid.

New in version 3.28.

Parameters:

crs (QgsCoordinateReferenceSystem) –

Return type:

Dict[str, Any]

featureToJson(feature: QgsFeature, context: QgsArcGisRestContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), flags: Union[QgsArcGisRestUtils.FeatureToJsonFlags, QgsArcGisRestUtils.FeatureToJsonFlag] = QgsArcGisRestUtils.FeatureToJsonFlags(static_cast<int>(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeGeometry)|static_cast<int>(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeNonObjectIdAttributes))) Dict[str, Any]

Converts a feature to an ArcGIS REST JSON representation.

New in version 3.28.

Parameters:
Return type:

Dict[str, Any]

fieldDefinitionToJson(field: QgsField) Dict[str, Any]

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

New in version 3.28.

Parameters:

field (QgsField) –

Return type:

Dict[str, Any]

geometryToJson(geometry: QgsGeometry, context: QgsArcGisRestContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) Dict[str, Any]

Converts a geometry to an ArcGIS REST JSON representation.

Returns an empty map if the geometry cannot be converted.

New in version 3.28.

Parameters:
Return type:

Dict[str, Any]

serviceTypeFromString(type: str) Qgis.ArcGisRestServiceType

Converts a string value to a REST service type.

New in version 3.28.

Parameters:

type (str) –

Return type:

Qgis.ArcGisRestServiceType

staticMetaObject = <PyQt5.QtCore.QMetaObject object>
variantToAttributeValue(variant: Any, expectedType: QVariant.Type, context: QgsArcGisRestContext) Any

Converts a variant to a REST attribute value.

New in version 3.28.

Parameters:
Return type:

Any