Class: QgsWkbTypes

class qgis.core.QgsWkbTypes

Bases: sip.wrapper

Handles storage of information regarding WKB types and their properties.

New in version 2.10: Enums

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.

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

Signals

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 – original type

See also

addZ()

See also

dropM()

See also

hasM()

New in version 2.12.

addZ(type: QgsWkbTypes.Type) → QgsWkbTypes.Type

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

Parameters

type – original type

See also

addM()

See also

dropZ()

See also

hasZ()

New in version 2.12.

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.

displayString(type: QgsWkbTypes.Type) → str

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

dropM(type: QgsWkbTypes.Type) → QgsWkbTypes.Type

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

Parameters

type – original type

See also

dropZ()

See also

addM()

New in version 2.14.

dropZ(type: QgsWkbTypes.Type) → QgsWkbTypes.Type

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

Parameters

type – original type

See also

dropM()

See also

addZ()

New in version 2.14.

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()

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.

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.

hasM(type: QgsWkbTypes.Type) → bool

Tests whether a WKB type contains m values.

Returns

True if type has m values

See also

addM()

See also

hasZ()

hasZ(type: QgsWkbTypes.Type) → bool

Tests whether a WKB type contains the z-dimension.

Returns

True if type has z values

See also

addZ()

See also

hasM()

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.

isMultiType(type: QgsWkbTypes.Type) → bool

Returns True if the WKB type is a multi type.

See also

isSingleType()

See also

multiType()

isSingleType(type: QgsWkbTypes.Type) → bool

Returns True if the WKB type is a single type.

See also

isMultiType()

See also

singleType()

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

flatType()

parseType(wktStr: str) → QgsWkbTypes.Type

Attempts to extract the WKB type from a WKT string.

Parameters

wktStr – a valid WKT string

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

flatType()

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 – The type to convert

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.

Returns

0 for point geometries, 1 for line geometries, 2 for polygon geometries Invalid geometry types will return a dimension of 0.

zmType(type: QgsWkbTypes.Type, hasZ: bool, hasM: bool) → QgsWkbTypes.Type

Returns the modified input geometry type according to hasZ / hasM