I have a problem to add a *.tab file as delimitedtext layer in QGIS 3.
uri = ("file:///{}?"
"&delimiter={}"
"&xField={}"
"&yField={}"
"&crs={}"
"&decimal").format(tab_text,
"\t",
"Rechtswert",
"Hochwert",
"EPSG:31468",",")
vlayer = QgsVectorLayer(uri, "layer", "delimitedtext")
If I test the layer with .isValid
I get a False. Did I have to name more variables?
JGH
44.4k3 gold badges49 silver badges95 bronze badges
1 Answer 1
Just add add another backslash when specifying tabs:
"\\t"
answered Jun 6, 2018 at 13:36
-
Thats not working because my delimiter is a tab. If I try double backslash i get "\t" as delimiterRickJames– RickJames2018年06月06日 15:08:08 +00:00Commented Jun 6, 2018 at 15:08
-
@RickJames - Yes, a single slash is shown for me in the layer's information but to import it, I had to use double slashes. Tested on QGIS 3.0.1 for Win 7 64-bit.Joseph– Joseph2018年06月06日 15:13:49 +00:00Commented Jun 6, 2018 at 15:13
-
1you are right it worked. The other problem was my coordinate system.RickJames– RickJames2018年06月06日 15:25:29 +00:00Commented Jun 6, 2018 at 15:25
-
@RickJames - Glad it worked :)Joseph– Joseph2018年06月06日 15:27:36 +00:00Commented Jun 6, 2018 at 15:27
-
Why the need to use \\t as oppose to \t.user1655130– user16551302022年12月07日 10:54:52 +00:00Commented Dec 7, 2022 at 10:54
lang-py