Points to Line with QGis

In a previous article we discussed how to create a layer lines from a
file text or Excel with Arcmap . Now is the turn with QGis.There are only two differences
:

  • the first is that it is not necessary to load the Excel table, and then save it in as a layer (shapefile)
  • the second is that there is no option to close automatically the lines by linking
    the last point to the first point of each line .

The file containing this information is an Excel
table such as :   

Regarding the creation of a layer of dots we have to count with an X and
a Y field that will create the corresponding point. In order to get  an entities line, we need a third essential
field that includes an identifying line: all points of a line will have the
same value for this field. A fourth field is necessary to indicate the order of
the points. but we will discuss how to create this field when using the
processing tool.

Let’s see the procedure in detail .

To create a layer from a virtual a Excel sheet , you need the Spreadsheet
Layers
plugin .

Go to the  Extensions menu ->
Install /
manageextensions and double-
click on the ” Spreadsheet layers ” extension .

In
the left vertical toolbar  you will notice
a new tool   

Click
on this tool .   

With the Browse button … point to your Excel file , and , if necessary
, with the drop-down menu select the sheet including your data .

Name the layer .

Check the box Geometry and enter the corresponding field names for X and
Y.

Select the SRC (reference system) for your data ( eg EPSG : 4236 if it’s
latitudes / longitudes).

Click OK.  

The points layer is displayed in QGis.

In the panel Treatments , go in GeoprocessingQGis ->creationofvectorsTools-> pointstolines
.

Before launching the tool , check that it, indeed,  exist an Id field that gives the order for the
recordings . If this is not the case :

  • select the layer you have just loaded

click on the ” Field Calculator ” tool , this opens the corresponding table  

  • Leave the check box Create new field checked
  • Name the field, for example Sorting or Order
  • To double-click the expression row_number or on Recordings -> $ id
  • Click OK. You will get a field available for the tool Points to lines .

Double-click the processing tool to run.  

Fill in the Input Layer fields
and grouping field and sort field.

If you want to create a file on the disk , click on the
button of Paths and give the file a name at the exit.

Click on RUN .

The final result is displayed in QGis.

Leave a Reply

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