9

I have a layer containing multiple lines representing flown tracks of airplanes. My goal is to create maps to analyse the flow of traffic in certain airspaces.

I would like to merge all parallel, or near parallel line, segments that are within a certain distance of each other (say, 1 nautical mile).

The new, merged, lines should contain an attribute containing the number of original lines that have been merged. For example, if 5 parallel lines are merged to one, the new merged line should have a count attribute of 5, which would allow me to style it accordingly.

Consider the following schematic example:

Input:

enter image description here

Three individual lines, two of which have a common parallel segment.

Desired output:

enter image description here

The common part of the green and orange lines have been merged to a single line (red). The new red line will have a count attribute of 2.

Note: in this example, the red line will be an average of the two original line segments. The remaining green and orange line segments do not have to connect exactly to the new red line. In other words, the topology does not have to be intact, since the result will only be used for visual representation.

Basically, I am trying to create something like this:

enter image description here

(source)

How would I go about achieving a result like this in QGIS? Bear in mind the actual dataset is much larger than my example above, so the solution should be scalable.

I came across this tutorial which does something very similar to what I am trying to do. However, I would like to be able to do it using QGIS.

1

First, you don't really want to make the lines to overlap, but only to reflect in the attributes the number of flights that are using the same path. This can be done following these steps:

Make sure you create a new column for your lines, call it "flights" and use the value 1 for all of them. I used the name "Count" which is not the best.

Then, perform a buffer operation with the desired proximity, you will have to play with the distance that you consider appropiate for your analysis: (my QGIS is in Spanish but I am sure you can figure it out)

Buffer

Then, you have buffered lines that are most likely touching each other, like sausages. Your last step is to perform a spatial join, under vector, data management menu. Use the options intersect, as follows:

join

Make sure you add the summary option with the sum. The result will be a new column in every attribute, adding the number of other flights that are intersecting. If the lines have an ID you can join this new column to your original lines, or you can turn the buffered polygons back into lines.

If you want to simplify and remove the extra lines is a different problem, but I hope I could have helped you to start at least.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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