I am trying to create a well-known text (wkt) file that can be imported into QGIS ver. 2.4.0

Here's a minimal working example of the geometry I wish to represent.

POLYGON((-125 52, -125 21, -98 21, -98 52, -125 52),(-120 50, -120 35, -100 35, -100 50, -120 50))

I have created a text file named polygon.wkt containing only the above wkt representation of a polygon. When I try to import it into QGIS (Layer/Add Delimited Text Layer) the import dialog responds "no data found in file."

How do I need to modify the file (a header, perhaps) to make it readable by QGIS?

Solution: I needed to think of the file as delimited text with a header line. For some reason, I needed more than a single field to make it work. See the code block below for the working solution to the minimal example I provided.

name, geom
"my polygon", "POLYGON((-125 52, -125 21, -98 21, -98 52, -125 52),(-120 50, -120 35, -100 35, -100 50, -120 50))"

1 Answer 1


Yes, you just need to add a header line to tell the imported the name of your geometry column, otherwise I guess it doesn't work, for instance:

"POLYGON((-125 52, -125 21, -98 21, -98 52, -125 52),(-120 50, -120 35, -100 35, -100 50, -120 50))"

I would also put quotation marks around the text as I have done. The importer should recognise that this is WKT and work accordingly. If you need to add more records you will need to think about how they are delimited etc, but qgis provides a number of options to parse delimited text so this shouldn't be an issue.

  • See my edited original question for how I made this work.
    – Gregory
    Jul 14, 2014 at 21:13

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.