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?

1 Answer 1

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.

2
  • If you wan to isolate the mentioned values, you can reclassify the raster. Check this: gis.stackexchange.com/questions/121532/…. Commented May 17, 2019 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
    Commented May 17, 2019 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.