I need to add a spatial csv-file with a specific path (folder and file name) in QGIS3x using a python script. I have tried: PyQGIS import csv- QGIS 3.4
uri = "file:///C:/users/heubacha/Test.csv?type=csv&delimiter=;&detectTypes=yes&xField=X_Wert_Pos&yField=Y_Wert_Pos&crs=epsg:25832&spatialIndex=no&subsetIndex=no&watchFile=no"
mem_layer = QgsVectorLayer(uri, 'Test', 'delimited text')
QgsProject.instance().addMapLayer(mem_layer)
no luck with that...warning: invalid data provider delimited text.
Trouble loading non-spatial data via CSV using Python for standalone script was not getting me anywhere either, because I need to add the path as a string somewhere in the coding, and that's not described there.
asked Jul 15, 2019 at 16:17
-
3'delimited text' is not correct,you need write 'delimitedtext'Fran Raga– Fran Raga2019年07月15日 16:22:30 +00:00Commented Jul 15, 2019 at 16:22
lang-py