3

Further to the question Assigning raster layer colors to polygons in QGIS, I have used the expression proposed by @Babel solution with a positive result.

Is it possible to use a similar expression for the colour parameter with the Field calc, so that it works with a polygon layer and extracts the average colour value of all the pixels that are within each polygon?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Nil Aspinall
  • 169
  • 5
  • What have you tried so far? For example, have you tried Zonal Statistics, and what sort of result did that give you? – Tom Brennan Feb 05 '24 at 06:21
  • Sorry. I am relatively new to using QGIS and am unifamiliar with the capabilities of Zonal Statistics. I will investigate this option. I just tried the solution from @Babel which I found great because is no necessary to do any pre-process – Nil Aspinall Feb 05 '24 at 07:38
  • 1
    Try Zonal Statistics, and then you can either answer your own question, or update the question with more detail. Keep in mind colours are just a mapping of the symbology - so an "average" colour might be a bit meaningless if you're randomly mapping individual colours. If on the other hand you have a graduated gray scale, then averaging should give you a pretty good outcome. – Tom Brennan Feb 05 '24 at 20:55

0 Answers0