Points to line in qGIS

5,493 views
Skip to first unread message

Chavoux Luyt

unread,
Oct 24, 2017, 7:31:02 AM10/24/17
to gis-in-eco...@googlegroups.com

Hi,

I am pretty sure this must be easy to do, but cannot figure it out.

I have a number of point observations (taken along a transect). Is there an easy way to transform them into a line (using e.g. the date & time of each observation) in qGIS? And then to (automatically?) calculate the length of the transect?

Thanks,
Chavoux

GIS in Ecology

unread,
Oct 24, 2017, 7:46:01 AM10/24/17
to GIS In Ecology Forum
Hi Chavoux,

This process is relatively easy, once you know what order to do things.

First, you need to prepare your data in a spreadsheet program, such as Excel. In this program, sort your data by time and date to ensure that they are in the order you want them to be connected together in. Once you have done this, add a new field and add a unique ID number to each line starting with 1 for the first one and increasing by 1 for each subsequent line). You need to do this because the points will be joined together based on their order in the attribute table of the point data layer you create and not based on your time/date field (and you can't change this order this once your point data layer has been created).

Next, add your modified data to QGIS as a point data layer (you can use either one of the tools to plot Excel data as points, or you can save them as a .CSV and use the Add Delimited Layer tool). 

Thirdly, if you have plotted your data using latitude and longitude, it will be in the geographic projection and you will need to use the SAVE AS option to transform it into an appropriate projection (such as your local national grid, or your local UTM). This will allow you to accurately calculate the lengths of your lines once you make them.

You are now ready to make your line data layer. There are a number of tools you can use to do this. These include the Points2One plug-in (under Plug-ins>ManagePlug-ins) and the V.Build.Polylines (under GRASS tools in the Toolbox Window). If one of these tools doesn't work for you, try the other one and see if it gives better results).

Finally, once you have your line data layer, you can open the attribute table and use the FIELD CALCULATOR tool to create a new field and fill it in with the length of each line segment (to do this select GEOMETRY> $length).

This is the basic process, but a few tweaks are needed depending on exactly what you want to do with your resulting line data layer and, and whether you need to add additional information about each line segment from the attribute table of your point data layer to your line data layer.

Hope this helps, and if anything doesn't work as stated or as expected, or if you have any follow-up questions, just post back on this thread.

All the best,

Colin 
Reply all
Reply to author
Forward
0 new messages