I have a vector data in text format like below, and i want to use it under QGIS as a vector layer.

Each polygon starts with one line and contains: number, type, number of points. Then follows the xys. It is not difficult to parse it with python.

Another text file contains the height of each building.

This file can't be imported as delimited text file into QGIS, and I can't figure out how to create a self-defined vector format.

Is there any way to load geometries from this kind of file into QGIS ?

enter image description here

  • 3
    What is your question?
    – DirkB.
    Jul 6, 2018 at 7:50
  • How can i import this kind of vector into QGIS?
    – Tao
    Jul 6, 2018 at 7:54
  • Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Jul 6, 2018 at 8:11

1 Answer 1


If you can parse your file with python, and do string manipulations with it, you can convert it to a CSV file and use WKT to define your geometries.

QGIS would then be able to load it easily. (Just specify "WKT" as the geometry format when loading the file). You will however need to specify the CRS within QGIS. So make sure you know it as well !

I've tried it manually, with the two buildings you provided, which looks like this :

id, class, geom
"1", "BUILDING", "POLYGON((208798.60 2469755.35, 208795.35 2469732.31, 208788.22 2469733.32, 208791.48 2469756.36, 208798.60 2469755.35))"
"2", "BUILDING", "POLYGON((209084.53 2470489.59, 209086.14 2470496.45, 209088.25 2470495.72, 209091.33 2470504.66, 209089.19 2470505.82, 209091.42 2470511.99, 209098.71 2470507.28, 209099.56 2470505.63, 209097.04 2470497.04, 209095.77 2470492.91, 209088.70 2470489.53, 209084.53 2470489.59))"

I was then able to import it into QGIS without an issue. I used a random CRS just to see if the result made any sense. It sort of does :

enter image description here

Looking at your file's structure, creating a script to convert the text from the base format and a working format looks very feasable. Just make sure that you fully comply to the WKT formatting rules.

Hope this works for you !

  • Thanks. I think it should be the only solution at the moment. I tried to convert it to GeoJSON. It works. But when the data is huge, it is not a very efficient way.
    – Tao
    Jul 6, 2018 at 12:53
  • Hi @Tao, glad that I could help. If you feel like the solution works best for you, feel free to mark it as "accepted" ! :)
    – GHRF
    Jul 6, 2018 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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