I have a polyline layer (pretty much an OSM network) that I need to count the total number of other link ends the primary link is attached to. In other words, I have over 59,000 links in a city network and I'm trying to measure connectivity. I want to count the number of endpoints to other links that each link is attached to.

I also need to maintain the edge IDs, which rules out the sDNA package.

I have a feeling there are python scripts I could use, but I'm not familiar with python (intermediate with R, but unfortunately no exp with igraph).

It would be great if there was a qgis version of Lines and Junctions tool from ArcGIS.


If you are interested in any node of the line (and not only start/end), you can simply use the existing tools:

  • extract the nodes from the lines (this will transfer the line entities attributes)
  • add a unique id to the nodes (using attribute calculator)
  • then compute the distance matrix.

Once you have the matrix, you can count all cells on a given line than fulfill the condition you want (=0 for exact matching, less than d if you have a threshold d).

| improve this answer | |

sDNA Individual Line Measures will compute this for you, and I think will preserve order of the input data so you can do a table join between your input and sDNA's output to get any other link attached data (such as IDs) back again.

(Failing that you could do it with a spatial join. None of the sDNA tools change the geometry they process other than sDNA Prepare).

| improve this answer | |

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.