1

Let's say I have a DTM and two vector shapefiles with zone A and zone B polygons. I want to add 10m to every point in the raster within zone A and I want to subtract 5m for every point in zone B.

Is there a more elegant way to do this than rasterising the shapefile?

i.e. I want something like

if in A: = DTM + 10
if in B: = DTM - 5
else: = DTM

I have used a workaround by rasterising the shapefile but it would be nice if there was a more direct way to do this.

2
  • 1
    You could clip your raster by both polygons, then add/substract the height, then use the raster calculator to overwrite the original raster values by those in the clipped and modified smaller rasters. This is a lengthy process, yes, but I don't know how else to do this.
    – Erik
    Commented Oct 28, 2021 at 14:23
  • This could work but I think you'd need r.patch to overwrite the values. The raster calculator returns no data if any of the input layers have no data at a pixel. Commented Oct 28, 2021 at 15:39

0

Your Answer

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