Subgroup: Geometry
Class: QgsGeometryCollection¶
-
class
qgis.core.
QgsGeometryCollection
¶ Bases:
qgis._core.QgsAbstractGeometry
Geometry collection
New in version 2.10: Methods
addGeometry
Adds a geometry and takes ownership. addMValue
addZValue
adjacentVertices
area
asGml2
asGml3
asJson
asWkb
asWkt
boundary
boundingBox
calculateBoundingBox
centroid
Returns the centroid of the geometry childCount
childGeometry
childPoint
clear
clearCache
clone
closestSegment
convertTo
Converts the geometry to a specified type. coordinateSequence
createEmptyWithSameType
deleteVertex
dimension
draw
dropMValue
dropZValue
fromCollectionWkt
Reads a collection from a WKT string. fromWkb
fromWkt
geometryN
Returns a geometry from within the collection. geometryType
hasChildGeometries
hasCurvedSegments
insertGeometry
Inserts a geometry before a specified index and takes ownership. insertVertex
is3D
Returns true if the geometry is 3D and contains a z-value. isEmpty
isMeasure
Returns true if the geometry contains m values. length
moveVertex
nCoordinates
nextVertex
numGeometries
Returns the number of geometries within the collection. partCount
perimeter
removeDuplicateNodes
removeGeometry
Removes a geometry from the collection. ringCount
segmentLength
segmentize
Returns a geometry without curves. setZMTypeFromSubGeometry
snappedToGrid
toCurveType
transform
transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1) vertexAngle
vertexAt
vertexCount
vertexNumberFromVertexId
vertices
Returns Java-style iterator for traversal of vertices of the geometry wkbType
Returns the WKB type of the geometry. wktOmitChildType
Returns whether child type names are omitted from Wkt representations of the collection wktTypeStr
Returns the WKT type string of the geometry. Attributes
MaximumAngle
MaximumDifference
-
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 = '') → QDomElement¶
-
asGml3
(self, doc: QDomDocument, precision: int = 17, ns: str = '') → QDomElement¶
-
asJson
(self, precision: int = 17) → str¶
-
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
-
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¶
-
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.
Parameters: nr – index of geometry to remove Returns: true if removal was successful.
-
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¶
-
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.
-