Skip to main content
added 30 characters in body; edited tags; edited title
Source Link
Taras
  • 35.8k
  • 6
  • 77
  • 152

How to turn WKBtype Turning WKB type integer into text for memory layer creation in QGISwith PyQGIS

I'm creating a memory layer in QGis pythonPyQGIS and I need to match the geometry of the memory layer that I am building to the geometry of another layer.

After some investigation it seems to me that, as per QGIS 2.2 Documentation and the QGIS 2.2 API Documentation, the URI defining the geometry type approximately matches the QGis::WkbTypeQGis::WkbType member enumeration text.

I know I can easily query the WKBTypeWKBType of my input layer with

myWkbType=mylayer.dataProvider().geometryType()
myWkbType = mylayer.dataProvider().geometryType()

However, this returns an integer, whereas the constructor requires text. Is there a simple built-in pyQGISPyQGIS way to turn these constants into text, or do I need to build a hacky little reverse mapping function for it?

How to turn WKBtype integer into text for memory layer creation in QGIS

I'm creating a memory layer in QGis python and I need to match the geometry of the memory layer that I am building to the geometry of another layer.

After some investigation it seems to me that, as per QGIS 2.2 Documentation and the QGIS 2.2 API Documentation, the URI defining the geometry type approximately matches the QGis::WkbType member enumeration text.

I know I can easily query the WKBType of my input layer with

myWkbType=mylayer.dataProvider().geometryType()

However, this returns an integer whereas the constructor requires text. Is there a simple built-in pyQGIS way to turn these constants into text or do I need to build a hacky little reverse mapping function for it?

Turning WKB type integer into text for memory layer creation with PyQGIS

I'm creating a memory layer in PyQGIS and I need to match the geometry of the memory layer that I am building to the geometry of another layer.

After some investigation it seems to me that, as per QGIS 2.2 Documentation and the QGIS 2.2 API Documentation, the URI defining the geometry type approximately matches the QGis::WkbType member enumeration text.

I know I can easily query the WKBType of my input layer with

myWkbType = mylayer.dataProvider().geometryType()

However, this returns an integer, whereas the constructor requires text. Is there a simple built-in PyQGIS way to turn these constants into text, or do I need to build a hacky little reverse mapping function for it?

Source Link
Mr Purple
  • 1.5k
  • 12
  • 28

How to turn WKBtype integer into text for memory layer creation in QGIS

I'm creating a memory layer in QGis python and I need to match the geometry of the memory layer that I am building to the geometry of another layer.

After some investigation it seems to me that, as per QGIS 2.2 Documentation and the QGIS 2.2 API Documentation, the URI defining the geometry type approximately matches the QGis::WkbType member enumeration text.

I know I can easily query the WKBType of my input layer with

myWkbType=mylayer.dataProvider().geometryType()

However, this returns an integer whereas the constructor requires text. Is there a simple built-in pyQGIS way to turn these constants into text or do I need to build a hacky little reverse mapping function for it?