1

I'm attempting to reduce a raster layer, wherein each point represents night-time luminosity/intensity of city lights, to include only those pixels with values in the top 10% of values. Effectively, I'm hoping to generate a new raster layer that only includes the brightest points. I'd imagine I could do so via some sort of 90% quintile masking specification but am at a loss as to how this might be accomplished in QGIS. Doing so via the expression table for a vector layer makes sense to me, but how might this be done in the case of a raster?

StCr7
  • 55
  • 6

1 Answers1

3

It's easy to mask specific raster values in the Layer Styling panel.

Option one: when the raster has a wide range of values

  • Choose "Singleband Gray" or Singleband Pseudocolor"
  • Expand the Min / Max Value Settings section, choose "Cumulative count cut" and enter 90% for the min value, and 100% for the max value
  • Choose the Contrast Enhancement setting that works best for you (I think you'll want "stretch and clip to min/max" but try them all and see what you like).

enter image description here

Option two: when the raster has only a few values

  • Choose "Paletted / Unique Values"
  • Click "Classify"
  • Select and remove the values that you don't want to see

enter image description here


Note: It's also possible to create a new raster layer without the masked values using the Raster Calculator.

csk
  • 24,827
  • 3
  • 32
  • 70
  • If you wan to isolate the mentioned values, you can reclassify the raster. Check this: https://gis.stackexchange.com/questions/121532/how-to-reclass-a-raster-with-reclassify-grid-values-in-qgis. – Gerardo Jimenez May 17 '19 at 19:52
  • 1
    also, might want to change from 'estimate' to 'actual' in the accuracy setting? Should make sure it recalculates the histogram (although maybe not required if you change the percentile breaks manually?) – Steven Kay May 17 '19 at 20:49