[GIS] How to change the extent of a clipped raster layer in qgis to be the mbb

clipextentsqgisraster

I have a raster layer that I have clipped using a polygon in qgis. The extent of the raster layer did not change.
How do I update the extent of my raster layer so that it is the minimum bounding box of my clipping?

Best Answer

To change the extent of raster,

(1) SAGA tools from Processing Toolboxcan fit the raster extent to the clipped image.

Step 1: Reclassify the area outside of the image from zero to nodata

First, activate Processing Tools | SAGA | Raster Tools | Reclassify values

Options can be set as:

  • Grid: your raster file
  • Method: single (default)
  • old value: 0.000000 (default)
  • new value: -99999
  • Check replace no data values checkbox
  • new value for no data values: -99999
  • Uncheck replace other values

and [Run]

Step 2: Crop to data

Then next tool is Processing Tools | SAGA | Raster Tools | Crop to data

  • Input layer: Reclassified layer

and [Run]


However, if you can go back to the clipping process (Clipper), you would get an optimized extent, and the above steps are unnecessary.

(2) Clipper

  • Choose Mask layer clipping mode
  • Assign a polygon as Mask
  • Select an option Crop the extent of the target dataset to the extent of the cutline
Related Question