I would like to find the minimum, maximum and (weighted?) average value of the raster cells intersected by a line (vector) layer. This is similar to what common "Zonal Statistics" tools do, but they all work on polygons only, not lines.

It appears that Hawths Tools have something similar called Line Raster Statistics, but I'm looking for an Open Source (non esri) solution.

I use QGIS, so either a native solution, plugin, or SQLite or PostGIS solution would be preferred.

2 Answers 2


For calculating stats from raster cells intersected by line, you can use GRASS v.rast.stats directly from QGIS processing toolbox. It can calculate 13 different stats.

enter image description here

enter image description here

  • 1
    Fantastic! I knew there would be an easy solution--I wasn't aware that this tool worked on lines, but it does! Oct 9, 2018 at 19:44

What about make a buffer on your lines ? This way you have polygons, and can join data back to your lines if you set an ID.

However be carefull with Zonal statistics, in 2.14 it could omit some pixel values if not totally covered by polygon.

Your Answer

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

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