# QGIS: list of coordinates to polygon [duplicate]

This question already has an answer here:

In the course of a monitoring exercise for small scale farmers, we captured the coordinates of fields using a GPS tracking in the SurveyCTO app. We used automatic capturing of the coordinates every 5 seconds to compensate for low GPS accuracy. Therefore, the coordinate list for every field is very long. With these coordinates, we would like to create polygons in QGIS to e.g. determine the size of fields. Unfortunately, the coordinates can only be extracted in one cell of an excel file. This looks like this:

Now my question is: Does anyone have a suggestion how we can import such a list into QGIS in a way that a polygon is created for each of these coordinate lists?

## marked as duplicate by Andre Silva, nmtoken, JGH, BERA, Richard LawNov 23 '18 at 23:20

You are going to need to edit the coordinates to make them into Polygons.

The easiest way is to open the file in excel (or open office) and adding a new string column where you concatenate "POLYGON((" to the start, then your coordinates replacing ';' with ',' and then add "))" on the end. So a formula something like:

``````=CONCATENATE("POLYGON((",SUBSTITUTE(B2,";",","),"))")
``````

At least in OpenOffice Calc.

Then you can save it as a CSV file and import it into QGIS using the delimited text import (and selecting WKT for the geometry).

You may run into issues with the polygons being invalid as the first and last points should be the same, in that case use:

``````=CONCATENATE("LINESTRING(",SUBSTITUTE(B2,";",","),")")
``````

to import them as lines and convert them to polygons in QGIS.

• Thank you very much for your suggestion - using MULTIPOLYGON worked! Due to the length of the coordinates for one polygon, I had to rearrange the data using the OFFSET function in Excel to switch the longitude and latitude since the coordinates exceeded 255 characters (too much for CONCATENATE). By adding a new column at the left margin with "MULTIPOLYGON(((", copying the first two coordinate columns to the right end of the sheet and adding ")))", it worked fine. Thank you very much! – cbr Jan 8 at 18:03

You'll have to manipulate the data a bit to get it to conform to WKT format in Excel or a text editor but then you may add it as a delimited text layer and use the WKT option:

https://en.wikipedia.org/wiki/Well-known_text

``````id~coord
1~POLYGON((-83.784 42.215, -83.264 42.256, -83.264 42.49, -83.784 42.215))
2~POLYGON((-83.784 42.415, -83.344 42.236, -83.94 42.999, -83.784 42.415))
3~POLYGON((-83.484 42.315, -83.244 42.346, -83.233 42.2, -83.484 42.315))
``````

• Thank you very much! It worked fine using a csv-file and the tildes could be avoided since the id and the coordinates were separated with a tab. Thank you! – cbr Jan 8 at 18:07

You can import it as a delimited text layer and choose WKT and polygon as the type of geometry.

• Thanks for the quick reply. Unfortunately, this only adds the csv file as attribute table ("NoGeometry" displayed in the properties) and not as shape file although I selected the "coord" column as geometry field and "polygon" as geometry type when importing as WKT... – cbr Nov 21 '18 at 15:08