2

I have a rasterised layer of a riverbed, which has been imported into QGIS with the exact dimensions I need (pictured)

Rasterized raw layer

The areas of no data have been filled using GDAL's 'fill nodata' tool.

Now, GDAL also fills the outer edges of the layer, therefore extending the size of the riverbed.

Filled layer

I have attempted to crop the filled layer to the size of the original rasterised layer by using the 'Clip raster by extent tool' (see attached), but it is not cropping the filled layer - it stays the same.

enter image description here

Can anyone tell me why the filled layer is not cropping and/or if there are any alternatives so I can achieve the original rasterised scan size?

T1230321
  • 93
  • 5

1 Answers1

3

Instead of using Raster > Extraction > Clip Raster by Extent...

you should be using Raster > Extraction > Clip Raster by Mask Layer...

Clip by Extent uses the max/min X/Y values of a Raster/Vector and spanns a Box that is lat/long aligned (i.e. vertical/horizontal alligned).

Clip by Mask Layer allows to clip with an arbitrary form. Since you input-raster is tiltet you would need to use this tool. However, the accepted input is a vector file. Therefore you would first need to create a vectorized version of you output. How you can create the vector-file is explained in many other questions, e.g. here.

Vincé
  • 1,416
  • 4
  • 17
  • Thanks for your reply. Whenever I attempt this and put the original rasterized layer into the 'mask layer' tab, it returns the error "ERROR 1: Cutline not of polygon type. Process returned error code 1" – T1230321 Nov 24 '22 at 12:09
  • Maybe it helps if you vectorize the raster from the mask layer first, have a look here: https://gis.stackexchange.com/a/259433/176374 – Vincé Nov 24 '22 at 12:23