I have a raster data(.tif), and would like to assign its values to line and polygon data by location. Here, I'd like to take min, max, mean and median.

There is "Join attributes by location", but it only supports joining between vector data and vector data.

Any tools or ideas ?enter image description here

  • Really good question. Still no solution? – Mustafa Uçar Feb 21 '18 at 7:00

For polygon feature, you can use Zonal statistics from raster -> Zonal statistics using QGIS 2.14.13 to get the min, max, mean and median of a raster:

enter image description here

enter image description here

enter image description here

But I am not aware of a tool that can get the same result using a line feature.

But as a workaround, you can create a small buffer polygon around the line and use Zonal statistics to get the min, max, mean and median, then intersect the original line with the buffered polygon to get a copy the attribute into the line feature.

  • Thank you, I tried your suggestion, but I encountered an error "ERROR 1 : NUMPY driver was compiled against GDAL 2.1 but current library version is 1.11". I posted new question about this problem. (gis.stackexchange.com/questions/238462/…) – Ichiro Apr 27 '17 at 16:17

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.