Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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).

share|improve this question

2 Answers 2

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.

share|improve this answer
    
In the next release of QGIS you will just be able to copy and paste WKT right into the canvas screenr.com/JVEH –  Nathan W Oct 29 '13 at 22:50

An alternative to Andre's answer is to use the Points2One plugin (get it via Plugins->Manage and install plugins). The trick using this approach is to have an ID field which identifies each point with a polygon. This ID is used to assemble the points into a polygon.

Andre's answer is excellent but this approach will save you creating the WKT file and allow you to use the spreadsheet directly (assuming you have one row per point - just save it as CSV with no modification and load using the Delimited Text loader).

share|improve this answer
    
The Geometry Import from CSV of the mmqgis plugin almost does the same thing in one step. P2O expects to have the points loaded in advance as delimited text layer. Both plugins are better if you have polygons with variable numbers of corners. –  AndreJ Oct 30 '13 at 9:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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