Class: QgsWkbTypes

class qgis.core.QgsWkbTypes

Bases: sip.wrapper

Handles storage of information regarding WKB types and their properties.

Methods

addM

Adds the m dimension to a WKB type and returns the new type

addZ

Adds the z dimension to a WKB type and returns the new type

coordDimensions

Returns the coordinate dimension of the geometry type as an integer.

curveType

Returns the curve type for a WKB type.

displayString

Returns a display string type for a WKB type, e.g., the geometry name used in WKT geometry representations.

dropM

Drops the m dimension (if present) for a WKB type and returns the new type.

dropZ

Drops the z dimension (if present) for a WKB type and returns the new type.

flatType

Returns the flat type for a WKB type.

geometryDisplayString

Returns a display string for a geometry type.

geometryType

Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a PolygonGeometry geometry type.

hasM

Tests whether a WKB type contains m values.

hasZ

Tests whether a WKB type contains the z-dimension.

isCurvedType

Returns True if the WKB type is a curved type or can contain curved geometries.

isMultiType

Returns True if the WKB type is a multi type.

isSingleType

Returns True if the WKB type is a single type.

multiType

Returns the multi type for a WKB type.

parseType

Attempts to extract the WKB type from a WKT string.

singleType

Returns the single type for a WKB type.

to25D

Will convert the 25D version of the flat type if supported or Unknown if not supported.

wkbDimensions

Returns the inherent dimension of the geometry type as an integer.

zmType

Returns the modified input geometry type according to hasZ / hasM

Attributes

CircularString

CircularStringM

CircularStringZ

CircularStringZM

CompoundCurve

CompoundCurveM

CompoundCurveZ

CompoundCurveZM

CurvePolygon

CurvePolygonM

CurvePolygonZ

CurvePolygonZM

GeometryCollection

GeometryCollectionM

GeometryCollectionZ

GeometryCollectionZM

LineGeometry

LineString

LineString25D

LineStringM

LineStringZ

LineStringZM

MultiCurve

MultiCurveM

MultiCurveZ

MultiCurveZM

MultiLineString

MultiLineString25D

MultiLineStringM

MultiLineStringZ

MultiLineStringZM

MultiPoint

MultiPoint25D

MultiPointM

MultiPointZ

MultiPointZM

MultiPolygon

MultiPolygon25D

MultiPolygonM

MultiPolygonZ

MultiPolygonZM

MultiSurface

MultiSurfaceM

MultiSurfaceZ

MultiSurfaceZM

NoGeometry

NullGeometry

Point

Point25D

PointGeometry

PointM

PointZ

PointZM

Polygon

Polygon25D

PolygonGeometry

PolygonM

PolygonZ

PolygonZM

Triangle

TriangleM

TriangleZ

TriangleZM

Unknown

UnknownGeometry

staticMetaObject

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

addZ()

See also

dropM()

See also

hasM()

New in version 2.12.

Return type

QgsWkbTypes.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

addM()

See also

dropZ()

See also

hasZ()

New in version 2.12.

Return type

QgsWkbTypes.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

wkbDimensions()

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

isMultiType()

See also

isCurvedType()

See also

singleType()

See also

flatType()

See also

multiType()

New in version 3.10.

Parameters

type (QgsWkbTypes.Type) –

Return type

QgsWkbTypes.Type

displayString(type: QgsWkbTypes.Type) → str

Returns a 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

dropZ()

See also

addM()

New in version 2.14.

Return type

QgsWkbTypes.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

dropM()

See also

addZ()

New in version 2.14.

Return type

QgsWkbTypes.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

singleType()

See also

multiType()

See also

curveType()

Parameters

type (QgsWkbTypes.Type) –

Return type

QgsWkbTypes.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

QgsWkbTypes.GeometryType

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

addM()

See also

hasZ()

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

addZ()

See also

hasM()

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

isSingleType()

See also

multiType()

Parameters

type (QgsWkbTypes.Type) –

Return type

bool

isSingleType(type: QgsWkbTypes.Type) → bool

Returns True if the WKB type is a single type.

See also

isMultiType()

See also

singleType()

Parameters

type (QgsWkbTypes.Type) –

Return type

bool

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

isMultiType()

See also

singleType()

See also

curveType()

See also

flatType()

Parameters

type (QgsWkbTypes.Type) –

Return type

QgsWkbTypes.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

QgsWkbTypes.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

isSingleType()

See also

multiType()

See also

curveType()

See also

flatType()

Parameters

type (QgsWkbTypes.Type) –

Return type

QgsWkbTypes.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

QgsWkbTypes.Type

Returns

the 25D version of the type or Unknown

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.

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
Return type

QgsWkbTypes.Type