Import Points in CSV Format to QGIS to Create Line and Polygon Shapefiles

Import Points in CSV Format to QGIS to Create Line and Polygon Shapefiles

In this post, we explained how to import points in CSV format to QGIS to create a point shapefile, Similarly we can import points in CSV format with easting/northing or longitude/latitude coordinates to create line or polygon shapefiles.

Suppose there is a CSV file generated by ROW survey to show the two property boundaries owned by ATT and CenterPoint respectively as show in Figure 1 (CSV, formatted). Each of the properties is defined by four corner points of 1 to 4. In the table, the column of Order is used to control how to connect points from begin (1) to end (4) to create a line or linestring, while the column of Owner-Group is used to separate different linestring groups (for example, all the points of ATT are to be connected together as a single linestring). The points’ coordinates are in Texas State Plane Coordinate System South Zone.

Figure 1

The above CSV file can be imported to QGIS and then converted to a line or a polygon shapefile. First open Data Source Manager and click “Delimited Text” on the left to select the CSV file to be imported (Figure 2). Make sure to check on or enable appropriate optional items as shown in Figure 2 and click “Add” button to add the CSV file to Layer’s panel of QGIS (Figure 3). You do NOT need to convert the imported CSV file to a point shapefile for this instruction.

Figure 2
Figure 3

Convert the points to a line shapefile using Points to Path: Open the command by searching “Points to Path” in Processing Toolbox. The Input layer is the point CSV file you just imported and Order expression is the field of “Order” and the Path group expression is “Owner-Group” (Figure 4). Type in a new shapefile name under “Paths” and the newly created line shapefile (paths of ID9.shp in Figure 4) is shown in Figure 5 along with its attribute table.

Figure 4
Figure 5

Convert the line shapefile to a polygon shapefile using Lines to Polygons…: Click Vector—>Geometry Tools—>Lines to Polygons… (Figure 6). The Input layer is the line shapefile and type in a shapefile name for the polygon to be created (Figure 7). If only certain lines are to be converted, ensure to select those lines/features first and then enable “Selected features only” under Input layer option in Figure 7.

Figure 6
Figure 7

The created polygon shapefile (polygons from lines.shp in Figure 7) and its attribute table are shown in Figure 8.

Figure 8

Leave a Reply

Your email address will not be published. Required fields are marked *