2

The Terrain panel of the 3D configuration window allows selecting "DEM" as the type then selecting a layer for the elevation data, but it defaults to using the first band of that layer for elevation values with no obvious option for choosing a different band.

How can I get a 3D view to use the second, third, etc. band of a raster layer for elevation data? This is super easy to do for the main 2D view in the Layer Styling panel.

1 Answer 1

2

Use Raster calculator to create a new raster layer of the band you want to use, then use this layer for elevation values. In this way, you kind of "extract" (isolate) the band.

The expression in the raster calculator is simply raster@2, where raster is the name of the raster layer, 2 is the no. of the band.

Digital Elevation Models normally just have one band, containing the elevation value, so there should be no need to address any bands (would be interesting to hear what kind of raster you have).

8
  • 1
    Thanks! It's a couple extra steps but I'm able to get the 3D views I need like this. I'm building custom raster files that combine surface type, terrain height, and surface height in a single file, then reviewing them in QGIS. Commented Mar 16, 2022 at 21:17
  • So creating the rasters in a way that band no. 1 contains always the elevation data would be probably an easier option?
    – Babel
    Commented Mar 16, 2022 at 21:19
  • Probably not. The files have both terrain and surface elevation data, both of which I'll want to examine. I'm also embedding color map data for the surface type band, and that data can only get attached to band one, so surface type has to be band one. It's interesting how well QGIS generally handles multi-band files but there isn't a provision for that here. 🤷‍♂️ Commented Mar 16, 2022 at 21:36
  • So the question arises why you want to combine these different kind of information to one single raster? Why not loading them as three different layers? That's established practice and the reason why the function you're looking for does not exist, as it normally doesn't make sense.
    – Babel
    Commented Mar 16, 2022 at 21:48
  • I've been looking at it as: why triple, quadruple, or worse the number of files the user needs to manage with when the data naturally overlaps and is easily merged into a multi-band file? Using a multi-band file also ensures that each band covers the analysis area with the same CRS and resolution, which is important for usage here. We'll see what users think—I do have an option to read single-band files and merge them internally, but for my usage it's been easier to deal with a single file. Commented Mar 17, 2022 at 13:37

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.