[GIS] How to create a shapefile of polygons from points in a spreadsheet

qgisqgis-2

I have a spreadsheet that has 100 different polygons listed with UTM coordinates for the 4 corners of each polygon.

I want to turn the spreadsheet into a shapefile with 100 unique objects, 1 for each polygon (ideally with the object ID as the polygon name from the spreadsheet). I know I can use the convex hull(s) tool when I just have one polygon to create from a set of points, but I need to do this for a hundred (or thousand).

Best Answer

I would suggest to build a csv file with WKT representation of the polygons you want out of your excel data using some text functions.

The basic syntax is:

ID;WKT
1;POLYGON((-74.25 41.75, -74.0 41.75, -74.0 41.5, -74.25 41.5, -74.25 41.75))

It is important that the first polygon point must be repeated as the last, all points enclosed by double paranthesis, coordinates seperated by blanks, points seperated by commas, and therefore semicolon as delimiter.

Importing as Delimited text file you get one shapefile for all polygons, which can be dissolved in a second step.

Related Question