Class: QgsGeometryCheckError

This represents an error reported by a geometry check.

Note

This class is a technology preview and unstable API.

Added in version 3.4.

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsGeometryCheckError

Subclasses

QgsGeometryCheckErrorSingle

Wraps a QgsSingleGeometryError into a standard QgsGeometryCheckError. The single error can be obtained via singleError.

class qgis.analysis.QgsGeometryCheckError[source]

Bases: object

__init__(check: QgsGeometryCheck | None, layerFeature: QgsGeometryCheckerUtils.LayerFeature, errorLocation: QgsPointXY, vidx: QgsVertexId = QgsVertexId(), value: Any = None, valueType: QgsGeometryCheckError.ValueType = QgsGeometryCheckError.ValueOther)

Create a new geometry check error with the parent check and for the layerFeature pair at the errorLocation. Optionally the vertex can be specified via vixd and a value with its value Type for additional information.

Parameters:
__init__(check: QgsGeometryCheck | None, layerId: str | None, featureId: int, geometry: QgsGeometry, errorLocation: QgsPointXY, vidx: QgsVertexId = QgsVertexId(), value: Any = None, valueType: QgsGeometryCheckError.ValueType = QgsGeometryCheckError.ValueOther)

Create a new geometry check error with the parent check and for the layer with layerId and featureId. The geometry of the error and the errorLocation need to be specified in map coordinates. Optionally the vertex can be specified via vixd and a value with its value Type for additional information.

Parameters:
  • check (Optional[QgsGeometryCheck])

  • layerId (Optional[str])

  • featureId (int)

  • geometry (QgsGeometry)

  • errorLocation (QgsPointXY)

  • vidx (QgsVertexId = QgsVertexId())

  • value (Any = None)

  • valueType (QgsGeometryCheckError.ValueType = QgsGeometryCheckError.ValueOther)

__init__(a0: QgsGeometryCheckError)
Parameters:

a0 (QgsGeometryCheckError)

class Status

Bases: int

StatusFixFailed = 1
StatusFixed = 2
StatusObsolete = 3
StatusPending = 0
ValueArea = 1
ValueLength = 0
ValueOther = 2
class ValueType

Bases: int

virtual affectedAreaBBox(self) QgsRectangle[source]

The bounding box of the affected area of the error.

Return type:

QgsRectangle

check(self) QgsGeometryCheck | None[source]

The geometry check that created this error.

Return type:

Optional[QgsGeometryCheck]

virtual closeMatch(self, a0: QgsGeometryCheckError | None) bool[source]

Check if this error is almost equal to other. If this returns True, it can be used to update existing errors after re-checking.

Parameters:

a0 (Optional[QgsGeometryCheckError])

Return type:

bool

virtual contextBoundingBox(self) QgsRectangle[source]

The context of the error. For topology checks like gap checks this returns the context of an error and the involved features. May be a NULL rectangle.

Added in version 3.10.

Return type:

QgsRectangle

virtual description(self) str[source]

The error description. By default the description of the parent check will be returned.

Return type:

str

featureId(self) int[source]

The id of the feature on which this error has been detected.

Return type:

int

geometry(self) QgsGeometry[source]

The geometry of the error in map units.

Return type:

QgsGeometry

virtual icon(self) QIcon[source]

Returns an icon that should be shown for this kind of error.

Added in version 3.8.

Return type:

QIcon

virtual isEqual(self, other: QgsGeometryCheckError | None) bool[source]

Check if this error is equal to other. Is reimplemented by subclasses with additional information, comparison of base information is done in parent class.

Parameters:

other (Optional[QgsGeometryCheckError])

Return type:

bool

layerId(self) str

The id of the layer on which this error has been detected.

Return type:

str

location(self) QgsPointXY

The location of the error in map units.

Return type:

QgsPointXY

resolutionMessage(self) str[source]

A message with details, how the error has been resolved.

Return type:

str

setFixFailed(self, reason: str | None)[source]

Set the error status to failed and specify the reason for failure.

Parameters:

reason (Optional[str])

setFixed(self, method: int)[source]

Set the status to fixed and specify the method that has been used to fix the error.

Parameters:

method (int)

setObsolete(self)[source]

Set the error status to obsolete.

status(self) QgsGeometryCheckError.Status[source]

The status of the error.

Return type:

QgsGeometryCheckError.Status

virtual update(self, other: QgsGeometryCheckError | None)[source]

Update this error with the information from other. Will be used to update existing errors whenever they are re-checked.

Parameters:

other (Optional[QgsGeometryCheckError])

value(self) Any[source]

An additional value for the error. Lengths and areas are provided in map units.

See also

valueType()

Return type:

Any

valueType(self) QgsGeometryCheckError.ValueType[source]

The type of the value.

See also

value()

Return type:

QgsGeometryCheckError.ValueType

vidx(self) QgsVertexId

The id of the affected vertex. May be valid or not, depending on the check.

Return type:

QgsVertexId