Class: QgsGeometryCollection¶
-
class
qgis.core.
QgsGeometryCollection
¶ Bases:
qgis._core.QgsAbstractGeometry
Geometry collection
New in version 2.10: Enums
Methods
Adds a geometry and takes ownership.
Reads a collection from a WKT string.
Returns a geometry from within the collection.
Inserts a geometry before a specified index and takes ownership.
Returns the number of geometries within the collection.
Removes a geometry from the collection by index.
Attempts to allocate memory for at least
size
geometries.Returns a geometry without curves.
transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1)
Returns whether child type names are omitted from Wkt representations of the collection
Signals
Attributes
-
addGeometry
(self, g: QgsAbstractGeometry) → bool¶ Adds a geometry and takes ownership. Returns
True
in case of success.
-
addMValue
(self, mValue: float = 0) → bool¶
-
addZValue
(self, zValue: float = 0) → bool¶
-
adjacentVertices
(self, vertex: QgsVertexId) → Tuple[QgsVertexId, QgsVertexId]¶
-
area
(self) → float¶
-
asGml2
(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) → QDomElement¶
-
asGml3
(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) → QDomElement¶
-
asWkb
(self) → QByteArray¶
-
asWkt
(self, precision: int = 17) → str¶
-
boundary
(self) → QgsAbstractGeometry¶
-
boundingBox
(self) → QgsRectangle¶
-
calculateBoundingBox
(self) → QgsRectangle¶
-
childCount
(self) → int¶
-
childGeometry
(self, index: int) → QgsAbstractGeometry¶
-
childPoint
()¶
-
clear
(self)¶
-
clearCache
(self)¶
-
clone
(self) → QgsGeometryCollection¶
-
closestSegment
(self, pt: QgsPoint, epsilon: float = 4*DBL_EPSILON) → Tuple[float, QgsPoint, QgsVertexId, int]¶
-
coordinateSequence
(self) → object¶
-
createEmptyWithSameType
(self) → QgsGeometryCollection¶
-
deleteVertex
(self, position: QgsVertexId) → bool¶
-
dimension
(self) → int¶
-
draw
(self, p: QPainter)¶
-
dropMValue
(self) → bool¶
-
dropZValue
(self) → bool¶
-
fromCollectionWkt
(self, wkt: str, subtypes: object, defaultChildWkbType: str = '') → bool¶ Reads a collection from a WKT string.
-
fromWkb
(self, wkb: QgsConstWkbPtr) → bool¶
-
fromWkt
(self, wkt: str) → bool¶
-
geometryN
(self, n: int) → QgsAbstractGeometry¶ Returns a geometry from within the collection.
- Parameters
n – index of geometry to return. An IndexError will be raised if no geometry with the specified index exists.
-
geometryType
(self) → str¶
-
hasChildGeometries
()¶
-
hasCurvedSegments
(self) → bool¶
-
insertGeometry
(self, g: QgsAbstractGeometry, index: int) → bool¶ Inserts a geometry before a specified index and takes ownership. Returns
True
in case of success.- Parameters
g – geometry to insert. Ownership is transferred to the collection.
index – position to insert geometry before
-
insertVertex
(self, position: QgsVertexId, vertex: QgsPoint) → bool¶
-
isEmpty
(self) → bool¶
-
isValid
(self, flags: int = 0) → Tuple[bool, str]¶
-
length
(self) → float¶
-
moveVertex
(self, position: QgsVertexId, newPos: QgsPoint) → bool¶
-
nCoordinates
(self) → int¶
-
nextVertex
(self, id: QgsVertexId) → Tuple[bool, QgsPoint]¶
-
numGeometries
(self) → int¶ Returns the number of geometries within the collection.
-
partCount
(self) → int¶
-
perimeter
(self) → float¶
-
removeDuplicateNodes
(self, epsilon: float = 4*DBL_EPSILON, useZValues: bool = False) → bool¶
-
removeGeometry
(self, nr: int) → bool¶ Removes a geometry from the collection by index.
An IndexError will be raised if no geometry with the specified index exists.
- Returns
True
if removal was successful.
-
reserve
(self, size: int)¶ Attempts to allocate memory for at least
size
geometries.If the number of geometries is known in advance, calling this function prior to adding geometries will prevent reallocations and memory fragmentation.
New in version 3.10.
-
ringCount
(self, part: int = 0) → int¶
-
segmentLength
(self, startVertex: QgsVertexId) → float¶
-
segmentize
(self, tolerance: float = M_PI_2/90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) → QgsAbstractGeometry¶ Returns a geometry without curves. Caller takes ownership
- Parameters
tolerance – segmentation tolerance
toleranceType – maximum segmentation angle or maximum difference between approximation and curve*
-
setZMTypeFromSubGeometry
()¶
-
snappedToGrid
(self, hSpacing: float, vSpacing: float, dSpacing: float = 0, mSpacing: float = 0) → QgsGeometryCollection¶
-
swapXy
(self)¶
-
toCurveType
(self) → QgsGeometryCollection¶
-
transform
(self, ct: QgsCoordinateTransform, d: QgsCoordinateTransform.TransformDirection = QgsCoordinateTransform.ForwardTransform, transformZ: bool = False)¶ transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1)
-
vertexAngle
(self, vertex: QgsVertexId) → float¶
-
vertexAt
(self, id: QgsVertexId) → QgsPoint¶
-
vertexCount
(self, part: int = 0, ring: int = 0) → int¶
-
vertexNumberFromVertexId
(self, id: QgsVertexId) → int¶
-
wktOmitChildType
(self) → bool¶ Returns whether child type names are omitted from Wkt representations of the collection
New in version 2.12.
-