I'm trying to use a vector file writer and I'm getting an unexpected WKB type of my output layer.
I'm setting up the writer like this
writer = QgsVectorFileWriter( output_layer, 'UTF-8', fields, QgsWKBTypes.PointZM , inlayer.crs() )
Below is information about my QGIS installation at the time.
When I check the properties of the shapefile that is generated, the geometry type is showing up as PointZ instead of PointZM. The simple script below should duplicate the problem.
##input_layer=vector ##output_layer=output vector from qgis.core import * from qgis.utils import * from PyQt4.QtCore import * inlayer = processing.getObject(input_layer) provider = inlayer.dataProvider() fields = provider.fields() writer = QgsVectorFileWriter( output_layer, 'UTF-8', fields, QgsWKBTypes.PointZM, inlayer.crs() ) feature = QgsFeature() feature.setGeometry(QgsGeometry(QgsPointV2(QgsWKBTypes.PointZM, 1, 2, 3, 4))) writer.addFeature(feature) del writer
It may be easier to test this in the python console with the following commands
>>> writer = QgsVectorFileWriter('c:/test/test_layer.shp', 'UTF8', QgsFields(), QgsWKBTypes.PointZM, QgsCoordinateReferenceSystem('EPSG:3857')) >>> feature = QgsFeature() >>> feature.setGeometry(QgsGeometry(QgsPointV2(QgsWKBTypes.PointZM, 1, 2, 3, 4))) >>> writer.addFeature(feature) True >>> del writer
Just make sure you have a test folder on the C drive and then you can add the generated shapefile to QGIS to inspect.