Class: QgsWkbTypes¶
Handles storage of information regarding WKB types and their properties.
Enums
The geometry types are used to group Qgis.WkbType in a coarse way. |
|
alias of |
Static Methods
Adds the m dimension to a WKB type and returns the new type |
|
Adds the z dimension to a WKB type and returns the new type |
|
Returns the coordinate dimension of the geometry type as an integer. |
|
Returns the curve type for a WKB type. |
|
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations. |
|
Drops the m dimension (if present) for a WKB type and returns the new type. |
|
Drops the z dimension (if present) for a WKB type and returns the new type. |
|
Returns the flat type for a WKB type. |
|
Returns a display string for a geometry type. |
|
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type. |
|
Tests whether a WKB type contains m values. |
|
Tests whether a WKB type contains the z-dimension. |
|
Returns |
|
Returns |
|
Returns |
|
Returns the linear type for a WKB type. |
|
Returns the multi type for a WKB type. |
|
Attempts to extract the WKB type from a WKT string. |
|
Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types. |
|
Returns the single type for a WKB type. |
|
Will convert the 25D version of the flat type if supported or Unknown if not supported. |
|
Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations. |
|
Returns the inherent dimension of the geometry type as an integer. |
|
Returns the modified input geometry type according to hasZ / hasM |
- class qgis.core.QgsWkbTypes[source]¶
Bases:
object
- class GeometryType(*values)¶
Bases:
IntEnum
The geometry types are used to group Qgis.WkbType in a coarse way.
Note
Prior to 3.30 this was available as
QgsWkbTypes
.GeometryType.Added in version 3.30.
Point
: PointsAvailable as
QgsWkbTypes.PointGeometry
in older QGIS releases.Line
: LinesAvailable as
QgsWkbTypes.LineGeometry
in older QGIS releases.Polygon
: PolygonsAvailable as
QgsWkbTypes.PolygonGeometry
in older QGIS releases.Unknown
: Unknown typesAvailable as
QgsWkbTypes.UnknownGeometry
in older QGIS releases.Null
: No geometryAvailable as
QgsWkbTypes.NullGeometry
in older QGIS releases.
- static addM(type: Qgis.WkbType) Qgis.WkbType [source]¶
Adds the m dimension to a WKB type and returns the new type
- Parameters:
type (Qgis.WkbType) – original type
See also
See also
See also
- Return type:
- static addZ(type: Qgis.WkbType) Qgis.WkbType [source]¶
Adds the z dimension to a WKB type and returns the new type
- Parameters:
type (Qgis.WkbType) – original type
See also
See also
See also
- Return type:
- static coordDimensions(type: Qgis.WkbType) int [source]¶
Returns the coordinate dimension of the geometry type as an integer. Returned value will be between 2-4, depending on whether the geometry type contains the Z or M dimensions. Invalid geometry types will return a dimension of 0.
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
int
- static curveType(type: Qgis.WkbType) Qgis.WkbType [source]¶
Returns the curve type for a WKB type. For example, for Polygon WKB types the curve type would be CurvePolygon.
Note
Returns CompoundCurve for CircularString (and its Z/M variants)
See also
See also
See also
See also
See also
See also
Added in version 3.10.
- Parameters:
type (Qgis.WkbType)
- Return type:
- static displayString(type: Qgis.WkbType) str [source]¶
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.
- Parameters:
type (Qgis.WkbType)
- Return type:
str
- static dropM(type: Qgis.WkbType) Qgis.WkbType [source]¶
Drops the m dimension (if present) for a WKB type and returns the new type.
- Parameters:
type (Qgis.WkbType) – original type
See also
See also
- Return type:
- static dropZ(type: Qgis.WkbType) Qgis.WkbType [source]¶
Drops the z dimension (if present) for a WKB type and returns the new type.
- Parameters:
type (Qgis.WkbType) – original type
See also
See also
- Return type:
- static flatType(type: Qgis.WkbType) Qgis.WkbType [source]¶
Returns the flat type for a WKB type. This is the WKB type minus any Z or M dimensions. For example, for PolygonZM WKB types the single type would be Polygon.
See also
See also
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
- static geometryDisplayString(type: Qgis.GeometryType) str [source]¶
Returns a display string for a geometry type.
This will return one of the following strings:
Point
Line
Polygon
Unknown Geometry
No Geometry
Invalid Geometry
- Parameters:
type (Qgis.GeometryType)
- Return type:
str
- static geometryType(type: Qgis.WkbType) Qgis.GeometryType [source]¶
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type. GeometryCollections are reported as
Qgis
.GeometryType.Unknown.- Parameters:
type (Qgis.WkbType)
- Return type:
- static hasM(type: Qgis.WkbType) bool [source]¶
Tests whether a WKB type contains m values.
- Return type:
bool
- Returns:
True
if type has m values
See also
See also
- Parameters:
type (Qgis.WkbType)
- static hasZ(type: Qgis.WkbType) bool [source]¶
Tests whether a WKB type contains the z-dimension.
- Return type:
bool
- Returns:
True
if type has z values
See also
See also
- Parameters:
type (Qgis.WkbType)
- static isCurvedType(type: Qgis.WkbType) bool [source]¶
Returns
True
if the WKB type is a curved type or can contain curved geometries.- Parameters:
type (Qgis.WkbType)
- Return type:
bool
- static isMultiType(type: Qgis.WkbType) bool [source]¶
Returns
True
if the WKB type is a multi type.See also
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
bool
- static isSingleType(type: Qgis.WkbType) bool [source]¶
Returns
True
if the WKB type is a single type.See also
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
bool
- static linearType(type: Qgis.WkbType) Qgis.WkbType [source]¶
Returns the linear type for a WKB type. For example, for a CompoundCurve, the linear type would be LineString.
See also
See also
See also
See also
See also
See also
Added in version 3.14.
- Parameters:
type (Qgis.WkbType)
- Return type:
- static multiType(type: Qgis.WkbType) Qgis.WkbType [source]¶
Returns the multi type for a WKB type. For example, for Polygon WKB types the multi type would be MultiPolygon.
See also
See also
See also
See also
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
- static parseType(wktStr: str | None) Qgis.WkbType [source]¶
Attempts to extract the WKB type from a WKT string.
- Parameters:
wktStr (Optional[str]) – a valid WKT string
- Return type:
- static promoteNonPointTypesToMulti(type: Qgis.WkbType) Qgis.WkbType [source]¶
Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types.
Specifically, this method should be used to determine the most-permissive possible resultant WKB type which can result from subtracting parts of a geometry. A single-point geometry type can never become a multi-point geometry type as a result of a subtraction, but a single-line or single-polygon geometry CAN become a multipart geometry as a result of subtracting portions of the geometry.
See also
See also
Added in version 3.24.
- Parameters:
type (Qgis.WkbType)
- Return type:
- static singleType(type: Qgis.WkbType) Qgis.WkbType [source]¶
Returns the single type for a WKB type. For example, for MultiPolygon WKB types the single type would be Polygon.
See also
See also
See also
See also
- Parameters:
type (Qgis.WkbType)
- Return type:
- static to25D(type: Qgis.WkbType) Qgis.WkbType [source]¶
Will convert the 25D version of the flat type if supported or Unknown if not supported.
- Parameters:
type (Qgis.WkbType) – The type to convert
- Return type:
- Returns:
the 25D version of the type or Unknown
- static translatedDisplayString(type: Qgis.WkbType) str [source]¶
Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.
Added in version 3.18.
- Parameters:
type (Qgis.WkbType)
- Return type:
str
- static wkbDimensions(type: Qgis.WkbType) int [source]¶
Returns the inherent dimension of the geometry type as an integer. Returned value will always be less than or equal to the coordinate dimension.
- Return type:
int
- Returns:
0 for point geometries, 1 for line geometries, 2 for polygon geometries Invalid geometry types will return a dimension of 0.
See also
- Parameters:
type (Qgis.WkbType)
- static zmType(type: Qgis.WkbType, hasZ: bool, hasM: bool) Qgis.WkbType [source]¶
Returns the modified input geometry type according to hasZ / hasM
- Parameters:
type (Qgis.WkbType)
hasZ (bool)
hasM (bool)
- Return type: