4

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

mgri
  • 16,159
  • 6
  • 47
  • 80
Ichiro
  • 305
  • 1
  • 10

1 Answers1

5

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.

ahmadhanb
  • 40,826
  • 5
  • 51
  • 105
  • 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. (https://gis.stackexchange.com/questions/238462/update-qgis-didnt-solve-error-numpy-driver-was-compiled-against-gdal-2-1) – Ichiro Apr 27 '17 at 16:17