27 Feb 2023

QGIS3: Find Minimum/Maximum/Mean Raster Value (Elevation) for Polygon Overlay

For finding raster value statistics (Min, Max, Mean) for a polygon overlay, I apply this expression in a virtual field by using the field calculator. The raster layer that I'm querying is named
'DGM_merged'
The functions is looking for the min. raster value at the polygon's nodes

array_min(
	array_foreach(
		generate_series(1, num_points($geometry), 1),
		raster_value('DGM_merged', 1, 
			point_n(nodes_to_points($geometry), @element)
		)
	)
)