1

I'm loading over 400 ASCII rasters into QGIS. They all get displayed as 'singleband grey' by default. Is there a way to change the style to 'singleband pseudocolor' by default? I also want to set the min-max values in the TOC to the actual min-max values in the raster (all rasters have different min-max values).

I know you can do this layer by layer manually using

  • Layer properties

  • Style

  • Band rendering/render type: Singleband pseudocolor

  • Load min/max values - accuracy: Actual (slower)

But that's undoable for 400+ rasters. So how can I set loading rasters to 'singleband pseudocolor' with actual min-max values by default?

1 Answer 1

1

Here are a few tips to speed up your process somewhat.

  1. Load all the rasters.
  2. In the Layer Styling panel, set up one raster with the desired Single Pseudoband Color style and set Load min/max values - accuracy: to Actual (slower).
  3. Right click on that raster in the layer panel > Style > Copy Style.
  4. Select all the other rasters in the layer panel. Right click > Style > Paste Style.

Now all of your rasters have Single Pseudoband Color style, with min/max values set to actual.

Note that it's faster to use the Layer Styling panel than to open the layer properties for each layer. Within the Style panel, you can switch from one layer to the next by selecting the layer from the dropdown menu at the top of the panel.

You may still have to manually re-classify the color bands. To automate this process, I suspect you will have to use the Python Console. Check out raster rendering in the PyQGIS Cookbook for more details. It looks fairly simple, as Python coding goes.

1
  • Thanks, very useful tips! I see that I can also switch layers in the Layer Styling panel by selecting a specific layer in the TOC. Then hit apply in the Layer Styling panel, and the actual min/max values are applied. Although, it's a pity that I have to do this manually. Ideally, I would like Qgis to behave like Arcmap when loading rasters: all raster have a different Color ramp (Singleband pseudocolor) and min/max values are set to the actual min/max values. I'll have to look into the PyQGIS Cookbook as you suggest..
    – Jan
    Commented Apr 17, 2019 at 9:57

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.