I´m using python in QGIS 2.2 and struggling with an error trying this:
# create layer from text
_vlayer = QgsVectorLayer(_ur1, "raw", "delimitedtext")
works fine but:
# export layer to shape
_writer = QgsVectorFileWriter.writeAsVectorFormat\
(_vlayer,"hoppla.shp","utf-8",None,"ESRI Shapefile")
... ends up wiht error code "3" - according to documentation:"ErrCreateLayer".
Answer
It's all about user rights.
Just changed to a directory I'm allowed to write, everything works fine.
_writer = QgsVectorFileWriter.writeAsVectorFormat(_vlayer,r"C:/Users/myName/xx/hoppla.shp","utf-8",None,"ESRI Shapefile")
No comments:
Post a Comment