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