I am new to GIS-related work and am currently using QGIS 3.34 for my research

I am trying to find the electricity grid topology and length of power lines between substations in the West of Sweden for performing power system analysis

I managed to get decent information from OSM (or OpenInfraMap to be exact) and mapped them in QGIS below as a start

enter image description here

From OSM, I have 104 Points layer for substation (black dots) and 845 Lines layer for power lines (blue lines).

Any way to combine both layers so that I can tell which power lines connect which substations?

I tried with the Intersection geoprocessing tools but didn't really work.

The end product that I am trying to make is this kind of table

Line ID Start Substation End Substation Length (in km)
1 x y 3
2 y z 4
3 z x 5

Could anyone help with finding the appropriate tools or workaround?

  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Jan 22 at 10:25
  • 1
    @BERA They are from OpenInfraMap which is based on OSM and I extracted them using the Overpass Turbo API Jan 22 at 12:09
  • I used this for extracting the substations nwr["power" = "substation"];, think nwr is node way relation for the layer type Jan 22 at 13:00
  • @BERA I am not sure if this will show properly in comment, but here goes[out:json][timeout:250]; // gather results for Västra Götaland {{geocodeArea:Västra Götaland}}->.searchArea; ( nwr["power" = "substation"](if:number(t["voltage"])>=100000)(area.searchArea); ); out body; >; out skel qt; note that I filter the voltage level of higher than 100kV in Västra Götaland Jan 22 at 18:46
  • Let us continue this discussion in chat. Jan 22 at 18:48

1 Answer 1


Here is a rough sketch on how you can approach this:

  1. Clean your lines. In your image they do not look like they are 845. You can do this using dissolve, either by id, name or something common for one power line. In case you dont have such information, you could dissolve all lines and then split the lines at the nearest substations and eventually also on power-line-crossings.
  2. Extract start and end vertices for each line and use "Join Attributes By Nearest", limited to one result to gather informations from substations.
  3. Since the extracted vertices will preserve the original line id's they come from you can now use an attribute join to get the information back to the initial lines.
  4. To measure the length of lines you can use a simple field calculation with $length.
  • Thanks for the input! I will try this approach. The 845 lines are based on the Feature Count, although the vertices can come up to 12k points. I believe the dissolve and join attributes are under the Vector processing tool? Jan 22 at 12:14

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