I'm trying to use QgsVectorLayer() function to add delimited text layer in QGIS. So I have a txt file (T_1999_1_2.txt) in path: "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T" and I want to create a shapefile named: T_1999_1_2.shp. The txt file structure is:
par;num;ano;mes;dia;D;btq 3;705;1999;1;2;-999,9;S;40,43885833;-8,43994167 3;619;1999;1;2;25,0;A;41,70972;-8,02699 3;718;1999;1;2;104,0;A;39,78055278;-8,82096667 3;766;1999;1;2;28,0;A;38,76620278;-9,12749444 3;560;1999;1;2;333,0;A;40,71492778;-7,89591667 3;669;1999;1;2;-999,9;S;39,83950000;-7,47866944 3;848;1999;1;2;-999,9;S;38,48486667;-7,47291667 3;555;1999;1;2;8,0;A;41,70655556;-8,80210833
I have tried to run the script but appears the same window error ("Error in file. File cannot be opened or delimiter parameters are not valid") My sript is the following one:
uri = "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T\T_1999_1_2.txt?delimiter=%s&xField=%s&yField=%s" % (";", "x", "y") vlayer = QgsVectorLayer(uri, "D:\PATRICIA\IG\QGIS\FWI\T\T_1999_1_2.shp", "delimitedtext")
I don't understand, why it doesn't work!! Any idea?
Thanks,
Pat.
أكثر...
par;num;ano;mes;dia;D;btq 3;705;1999;1;2;-999,9;S;40,43885833;-8,43994167 3;619;1999;1;2;25,0;A;41,70972;-8,02699 3;718;1999;1;2;104,0;A;39,78055278;-8,82096667 3;766;1999;1;2;28,0;A;38,76620278;-9,12749444 3;560;1999;1;2;333,0;A;40,71492778;-7,89591667 3;669;1999;1;2;-999,9;S;39,83950000;-7,47866944 3;848;1999;1;2;-999,9;S;38,48486667;-7,47291667 3;555;1999;1;2;8,0;A;41,70655556;-8,80210833
I have tried to run the script but appears the same window error ("Error in file. File cannot be opened or delimiter parameters are not valid") My sript is the following one:
uri = "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T\T_1999_1_2.txt?delimiter=%s&xField=%s&yField=%s" % (";", "x", "y") vlayer = QgsVectorLayer(uri, "D:\PATRICIA\IG\QGIS\FWI\T\T_1999_1_2.shp", "delimitedtext")
I don't understand, why it doesn't work!! Any idea?
Thanks,
Pat.
أكثر...