I am trying to turn a CSV of data into a shapefile using processing.

mStasIn = "C:\GIS_Abschluss\AirData\MeasurementStations.csv"
mStasOut = "C:\GIS_Abschluss\AirData\MeasurementStations.shp"

mStas = QgsVectorLayer(mStasPath, "mStas", "ogr")

            {'INPUT' : mStasIn,
            'XFIELD': 'xcoord',
            'YFIELD': 'ycoord',
            'ZFIELD': 0,
            'MFIELD': 0,
            'TARGET_CRS': 'EPSG:32633', 
            'OUTPUT': mStasOut})

iface.addVectorLayer(mStasOut, 'mStas', "ogr")

This creates a shapefile, but there are no points on my canvas.

  • Your script looks correct, but it's impossible to verify without also seeing the CSV contents – ndawson Jul 16 at 20:32
  • I've also tested your script, with some testdata and it works. So check your CSV like Nyall pointed out in his comment. By the way, it is better to avoid the backslash in path definitions in python, because some characters in combination with backslash have a special function like "\n" is a new line. so better use normal slash for that. – eurojam Jul 17 at 6:29

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.