Class: QgsArcGisRestUtils¶
Utility functions for working with ArcGIS REST services.
See also
Added in version 3.18.
List of all members, including inherited members
Enums
Flags which control the behavior of converting features to JSON. |
Methods
Static Methods
Converts ESRI JSON color data to a QColor object. |
|
Converts a date time value to a QDateTime. |
|
Converts an ESRI REST field type to a QVariant type. |
|
Converts an ESRI fill style to a Qt brush style. |
|
Converts an ESRI REST geometry JSON definition to a |
|
Converts an ESRI REST geometry type to a WKB type. |
|
Converts labeling JSON data to an equivalent QGIS vector labeling. |
|
Converts an ESRI labeling expression to a QGIS expression string. |
|
Converts an ESRI line style to a Qt pen style. |
|
Converts a rectangle value to a |
|
Converts renderer JSON data to an equivalent |
|
Converts a spatial reference JSON definition to a |
|
Converts a symbol JSON definition to a |
|
Converts a crs to an ArcGIS REST JSON representation. |
|
Converts a feature to an ArcGIS REST JSON representation. |
|
Converts a field's definition to an ArcGIS REST JSON representation. |
|
Converts a geometry to an ArcGIS REST JSON representation. |
|
Converts a string value to a REST service type. |
|
Converts a variant to a REST attribute value. |
- class qgis.core.QgsArcGisRestUtils[source]¶
Bases:
object- class FeatureToJsonFlag(*values)¶
Bases:
IntFlagFlags which control the behavior of converting features to JSON.
Added in version 3.28.
IncludeGeometry: Whether to include the geometry definitionIncludeNonObjectIdAttributes: Whether to include any non-objectId attributesSkipUnsetAttributes: Skip unset attributes.Added in version 3.44.
- IncludeGeometry = 1¶
- IncludeNonObjectIdAttributes = 2¶
- SkipUnsetAttributes = 4¶
- FeatureToJsonFlags()¶
- static convertColor(data: Any) QColor[source]¶
Converts ESRI JSON color data to a QColor object.
- Parameters:
data (Any)
- Return type:
QColor
- static convertDateTime(value: Any) QDateTime[source]¶
Converts a date time
valueto a QDateTime.- Parameters:
value (Any)
- Return type:
QDateTime
- static convertFieldType(type: str | None) QMetaType.Type[source]¶
Converts an ESRI REST field
typeto a QVariant type.- Parameters:
type (Optional[str])
- Return type:
QMetaType.Type
- static convertFillStyle(style: str | None) Qt.BrushStyle[source]¶
Converts an ESRI fill
styleto a Qt brush style.- Parameters:
style (Optional[str])
- Return type:
Qt.BrushStyle
- static convertGeometry(geometry: dict[str | None, Any], esriGeometryType: str | None, hasM: bool, hasZ: bool, allowCurves: bool = True)¶
Converts an ESRI REST
geometryJSON definition to aQgsAbstractGeometry.Caller takes ownership of the returned object.
- Parameters:
geometry (dict[Optional[str], Any]) – JSON geometry definition
esriGeometryType (Optional[str]) – ESRI geometry type string
hasM (bool) – set to
Trueto if geometry includes M valueshasZ (bool) – set to
Trueto if geometry includes Z valuesallowCurves (bool = True) – controls whether the returned geometry can be a curved geometry type (since QGIS 4.0)
- Return type:
(Optional[QgsAbstractGeometry], Optional[QgsCoordinateReferenceSystem])
- Returns:
converted geometry
crs: the parsed geometry CRS
- static convertGeometryType(type: str | None) Qgis.WkbType[source]¶
Converts an ESRI REST geometry
typeto a WKB type.- Parameters:
type (Optional[str])
- Return type:
- static convertLabeling(data: Iterable[Any]) QgsAbstractVectorLayerLabeling | None¶
Converts labeling JSON
datato an equivalent QGIS vector labeling.Caller takes ownership of the returned object.
- Parameters:
data (Iterable[Any])
- Return type:
- static convertLabelingExpression(string: str | None) str[source]¶
Converts an ESRI labeling expression to a QGIS expression string.
- Parameters:
string (Optional[str])
- Return type:
str
- static convertLineStyle(style: str | None) Qt.PenStyle[source]¶
Converts an ESRI line
styleto a Qt pen style.- Parameters:
style (Optional[str])
- Return type:
Qt.PenStyle
- static convertRectangle(value: Any) QgsRectangle[source]¶
Converts a rectangle
valueto aQgsRectangle.Returns a null rectangle if the value cannot be converted.
Added in version 3.34.
- Parameters:
value (Any)
- Return type:
- static convertRenderer(rendererData: dict[str | None, Any]) QgsFeatureRenderer | None¶
Converts renderer JSON
datato an equivalentQgsFeatureRenderer.Caller takes ownership of the returned renderer.
- Parameters:
- Return type:
- static convertSpatialReference(spatialReferenceMap: dict[str | None, Any]) QgsCoordinateReferenceSystem[source]¶
Converts a spatial reference JSON definition to a
QgsCoordinateReferenceSystemvalue.- Parameters:
- Return type:
- static convertSymbol(definition: dict[str | None, Any]) QgsSymbol | None¶
Converts a symbol JSON
definitionto aQgsSymbol.Caller takes ownership of the returned symbol.
- static crsToJson(crs: QgsCoordinateReferenceSystem) dict[str, Any][source]¶
Converts a
crsto an ArcGIS REST JSON representation.Returns an empty map if the
crsis not valid.Added in version 3.28.
- Parameters:
- Return type:
dict[str, Any]
- static featureToJson(feature: QgsFeature, context: QgsArcGisRestContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), flags: QgsArcGisRestUtils.FeatureToJsonFlag = QgsArcGisRestUtils.FeatureToJsonFlags(unknown - type(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeGeometry) | unknown - type(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeNonObjectIdAttributes))) dict[str, Any][source]¶
Converts a
featureto an ArcGIS REST JSON representation.Added in version 3.28.
- Parameters:
feature (QgsFeature)
context (QgsArcGisRestContext)
crs (
QgsCoordinateReferenceSystem= QgsCoordinateReferenceSystem())flags (QgsArcGisRestUtils.FeatureToJsonFlag = QgsArcGisRestUtils.FeatureToJsonFlags(unknown-type(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeGeometry)|unknown-type(QgsArcGisRestUtils.FeatureToJsonFlag.IncludeNonObjectIdAttributes)))
- Return type:
dict[str, Any]
- static fieldDefinitionToJson(field: QgsField) dict[str, Any][source]¶
Converts a
field’s definition to an ArcGIS REST JSON representation.Added in version 3.28.
- static geometryToJson(geometry: QgsGeometry, context: QgsArcGisRestContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) dict[str, Any][source]¶
Converts a
geometryto an ArcGIS REST JSON representation.Returns an empty map if the geometry cannot be converted.
Added in version 3.28.
- Parameters:
geometry (QgsGeometry)
context (QgsArcGisRestContext)
crs (
QgsCoordinateReferenceSystem= QgsCoordinateReferenceSystem())
- Return type:
dict[str, Any]
- static serviceTypeFromString(type: str | None) Qgis.ArcGisRestServiceType[source]¶
Converts a string value to a REST service type.
Added in version 3.28.
- Parameters:
type (Optional[str])
- Return type:
- static variantToAttributeValue(variant: Any, expectedType: QMetaType.Type, context: QgsArcGisRestContext) Any[source]¶
Converts a variant to a REST attribute value.
Added in version 3.28.
- Parameters:
variant (Any)
expectedType (QMetaType.Type)
context (QgsArcGisRestContext)
- Return type: