Doing network analysis in QGIS. This is where I came from:

  • Start situation: + 600 points with fid and 1 relevant attribute. Also road network data.
  • First step: ran "network tools - service area (from layer)" with 3000 meters. Result: line features covering 3000 meters of the road network from each point.
  • Second step: the same thing but 5000 meters.

So in this point I have two line data layers, both with +600 features. One row in each table represents one service area and has the original fid + one relevant attribute.

Now I should subtract the 3000m service areas from the 5000 service areas in order to find those lines that are exactly between 3000m and 5000m from the point. How should this be done? I of course want to subtract the corresponding fids (eg. 5000m fid =145 subtracted with 3000m fid=145).

  • Can you use python in QGIS? I presume, a for loop selecting each fid seperately would work.
    – MarcM
    Sep 25, 2020 at 8:57
  • My python skills are next to zero so I'd have to ask help for that. Any ideas if some batch-processing tool or graphical modeler would do the trick? I was first thinking about using 'Geometry by expression' or 'Extract by expression'. But didn't have enough wisdom to come up with the expression.
    – Matti Pesu
    Sep 25, 2020 at 9:54

1 Answer 1


Answering to my own question. I tried a python script made by a friend. It had some issues so finally ended up doing batch processing:

  1. Extracted all the features to individual geopackage layers
  2. Did the difference ("5000m minus 3000m")
  3. Merged result layers to one geopackage layer.

The latest QGIS functionality in batch processing tools is very good when filling up the massive "task table".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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