1

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.

  • 3
    'delimited text' is not correct,you need write 'delimitedtext' – Fran Raga Jul 15 at 16:22
  • Wow, thank you so much! You made my day :) – GISme Jul 16 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.