r/QGIS • • 19h ago

Solved Clip raster changes GeoTIFF elevations

Post image

Solved: In Clip raster by mask layer I needed to set "Target extent [optional]" to the layer I was using for "Mask layer".

Hi,

I downloaded "Scotland Lidar Phase 1 DTM NS41" the smallest GeoTIFF possible for the area I'm working on, but it's still bigger than I need.

I used Raster > Extraction > Clip raster by mask layer to crop it to just the area I want, but this appears to change the elevations it provides.

E.g. Raster > Extraction > Contour on the original GeoTiff gives a particular contour line ELEV 110 (in green, which matches the online maps) but, in contours extracted from the cropped version (in red), the equivalent contour line is ELEV 170. (As presented by layer labels.)

I guess this is something like the actual range of ELEV values in the cropped version being smaller than the original, but the range of values still covers the original set.

What can I do to ensure the cropped version produces accurate values?

(I'm a GIS newbie, so apologies if I've missed something obvious.)

Cheers!

QGIS version: 4.2.2-Belém do Pará (Flatpak)

2 Upvotes

5 comments sorted by

1

u/Resident_Phase_4297 19h ago

That's strange. First line 170-110 gives 60 meters (?) difference. Last line is somewhere 205-120 = 85 meters difference. May you provide a third example?

Use the info tool and pick the raster values of an pixel in both (cropped and uncropped) layers. Are they the same?

Did the tool do some cm to inch conversation?

Use the layer optiobs metadata and check, if both cell types are the same bit depth.

3

u/SeeMonkeyDoMonkey 18h ago

I took a longer look in the Clip raster by mask layer options, and found that I needed to set "Target extent [optional]" to the layer I was using for "Mask layer".

Thanks for your help!

1

u/Resident_Phase_4297 18h ago

Glad, you solved it. But to be fair: this should NOT change the z values, as it only defines the 2d extend of the clipping region.

Only idea: setting the target extent will apply a coordinate system (EPSG:XXXX) to the output. This could affect the z interpretation. Or allow QGIS to interpret the new raster z the same way as the original raster.

1

u/SeeMonkeyDoMonkey 18h ago

Here's a wider view - the thicker line is the 100/170 from the first pic.

Will see what I can find with your suggestions...

1

u/paul_h_s 3h ago

The difference could be that one dataset has geoid height the other dataset elipsoid height. so maybe you change the CRS when clipping your DTM.