Class: QgsWkbTypes¶
- class qgis.core.QgsWkbTypes¶
Bases:
sip.wrapper
Handles storage of information regarding WKB types and their properties.
New in version 2.10:
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
True
if the WKB type is a curved type or can contain curved geometries.Returns
True
if the WKB type is a multi type.Returns
True
if the WKB type is a single type.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
Attributes
- CircularString = 8¶
- CircularStringM = 2008¶
- CircularStringZ = 1008¶
- CircularStringZM = 3008¶
- CompoundCurve = 9¶
- CompoundCurveM = 2009¶
- CompoundCurveZ = 1009¶
- CompoundCurveZM = 3009¶
- CurvePolygon = 10¶
- CurvePolygonM = 2010¶
- CurvePolygonZ = 1010¶
- CurvePolygonZM = 3010¶
- GeometryCollection = 7¶
- GeometryCollectionM = 2007¶
- GeometryCollectionZ = 1007¶
- GeometryCollectionZM = 3007¶
- class GeometryType¶
Bases:
int
- baseClass¶
alias of
QgsWkbTypes
- LineGeometry = 1¶
- LineString = 2¶
- LineString25D = -2147483646¶
- LineStringM = 2002¶
- LineStringZ = 1002¶
- LineStringZM = 3002¶
- MultiCurve = 11¶
- MultiCurveM = 2011¶
- MultiCurveZ = 1011¶
- MultiCurveZM = 3011¶
- MultiLineString = 5¶
- MultiLineString25D = -2147483643¶
- MultiLineStringM = 2005¶
- MultiLineStringZ = 1005¶
- MultiLineStringZM = 3005¶
- MultiPoint = 4¶
- MultiPoint25D = -2147483644¶
- MultiPointM = 2004¶
- MultiPointZ = 1004¶
- MultiPointZM = 3004¶
- MultiPolygon = 6¶
- MultiPolygon25D = -2147483642¶
- MultiPolygonM = 2006¶
- MultiPolygonZ = 1006¶
- MultiPolygonZM = 3006¶
- MultiSurface = 12¶
- MultiSurfaceM = 2012¶
- MultiSurfaceZ = 1012¶
- MultiSurfaceZM = 3012¶
- NoGeometry = 100¶
- NullGeometry = 4¶
- Point = 1¶
- Point25D = -2147483647¶
- PointGeometry = 0¶
- PointM = 2001¶
- PointZ = 1001¶
- PointZM = 3001¶
- Polygon = 3¶
- Polygon25D = -2147483645¶
- PolygonGeometry = 2¶
- PolygonM = 2003¶
- PolygonZ = 1003¶
- PolygonZM = 3003¶
- Triangle = 17¶
- TriangleM = 2017¶
- TriangleZ = 1017¶
- TriangleZM = 3017¶
- class Type¶
Bases:
int
- baseClass¶
alias of
QgsWkbTypes
- Unknown = 0¶
- UnknownGeometry = 3¶
- addM(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
Adds the m dimension to a WKB type and returns the new type
- Parameters:
type (QgsWkbTypes.Type) – original type
See also
See also
See also
New in version 2.12.
- Return type:
- addZ(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
Adds the z dimension to a WKB type and returns the new type
- Parameters:
type (QgsWkbTypes.Type) – original type
See also
See also
See also
New in version 2.12.
- Return type:
- coordDimensions(type: QgsWkbTypes.Type) int ¶
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
New in version 2.14.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
int
- curveType(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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
New in version 3.10.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
- displayString(type: QgsWkbTypes.Type) str ¶
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
str
- dropM(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
Drops the m dimension (if present) for a WKB type and returns the new type.
- Parameters:
type (QgsWkbTypes.Type) – original type
See also
See also
New in version 2.14.
- Return type:
- dropZ(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
Drops the z dimension (if present) for a WKB type and returns the new type.
- Parameters:
type (QgsWkbTypes.Type) – original type
See also
See also
New in version 2.14.
- Return type:
- flatType(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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 (QgsWkbTypes.Type) –
- Return type:
- geometryDisplayString(type: QgsWkbTypes.GeometryType) str ¶
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
New in version 3.0.
- Parameters:
type (QgsWkbTypes.GeometryType) –
- Return type:
str
- geometryType(type: QgsWkbTypes.Type) QgsWkbTypes.GeometryType ¶
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type. GeometryCollections are reported as QgsWkbTypes.UnknownGeometry.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
- hasM(type: QgsWkbTypes.Type) bool ¶
Tests whether a WKB type contains m values.
- Return type:
bool
- Returns:
True
if type has m values
See also
See also
- Parameters:
type (QgsWkbTypes.Type) –
- hasZ(type: QgsWkbTypes.Type) bool ¶
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 (QgsWkbTypes.Type) –
- isCurvedType(type: QgsWkbTypes.Type) bool ¶
Returns
True
if the WKB type is a curved type or can contain curved geometries.New in version 2.14.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
bool
- isMultiType(type: QgsWkbTypes.Type) bool ¶
Returns
True
if the WKB type is a multi type.See also
See also
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
bool
- isSingleType(type: QgsWkbTypes.Type) bool ¶
Returns
True
if the WKB type is a single type.See also
See also
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
bool
- linearType(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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
New in version 3.14.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
- multiType(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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 (QgsWkbTypes.Type) –
- Return type:
- parseType(wktStr: str) QgsWkbTypes.Type ¶
Attempts to extract the WKB type from a WKT string.
- Parameters:
wktStr (str) – a valid WKT string
- Return type:
- promoteNonPointTypesToMulti(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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
New in version 3.24.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
- singleType(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
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 (QgsWkbTypes.Type) –
- Return type:
- staticMetaObject = <PyQt5.QtCore.QMetaObject object>¶
- to25D(type: QgsWkbTypes.Type) QgsWkbTypes.Type ¶
Will convert the 25D version of the flat type if supported or Unknown if not supported.
- Parameters:
type (QgsWkbTypes.Type) – The type to convert
- Return type:
- Returns:
the 25D version of the type or Unknown
- translatedDisplayString(type: QgsWkbTypes.Type) str ¶
Returns a translated display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.
New in version 3.18.
- Parameters:
type (QgsWkbTypes.Type) –
- Return type:
str
- wkbDimensions(type: QgsWkbTypes.Type) int ¶
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 (QgsWkbTypes.Type) –
- zmType(type: QgsWkbTypes.Type, hasZ: bool, hasM: bool) QgsWkbTypes.Type ¶
Returns the modified input geometry type according to hasZ / hasM
- Parameters:
type (QgsWkbTypes.Type) –
hasZ (bool) –
hasM (bool) –
- Return type: