3

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?

1

Just add add another backslash when specifying tabs:

"\\t"
  • Thats not working because my delimiter is a tab. If I try double backslash i get "\t" as delimiter – RickJames Jun 6 '18 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 Jun 6 '18 at 15:13
  • 1
    you are right it worked. The other problem was my coordinate system. – RickJames Jun 6 '18 at 15:25
  • @RickJames - Glad it worked :) – Joseph Jun 6 '18 at 15:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.