29

How do I crop a raster layer in QGIS?

I want to make contours from a section of a layer, and including the whole layer will create far more data than I need and slow down the rendering.

I have found that I can do it by using the Raster calculator and specifying a new layer extent, but how do I know what values to enter for the rows and columns?

I also tried cropping the geotiff in Photoshop, but it seemed to lose the coordinate data.

Is there any way to create contours from part of a raster layer without having to crop it first?

2
  • 1
    somehow related gis.stackexchange.com/questions/10117/…
    – nadya
    Commented Dec 24, 2012 at 3:18
  • 1
    Be careful whenever you crop a raster. If you crop to a non-multiple size you'll get unaccurate not-integer pixel size and it can get messy if you did not realized in time.
    – user19416
    Commented Jun 24, 2013 at 17:50

3 Answers 3

46

The Raster|Extraction|Clipper tool will help you to do this.

You can open the tool and then click and drag in the raster image to select the area you want to export as a new raster (Clipping mode: Extent), and then refine the exact coordinates in the Extent fields (if necessary).

Probably no way to do contours on only a selection of a raster; clip it this way first!

1
  • This helped me out enormously. Dutch ANH3 data comes in very large chunks and some processing code bugs out when it tries to process it. I was able to use QGIS to clip the area down and got some 0.5m resolution data for just the required area. Perfect! Commented Jan 18, 2022 at 15:43
3

I think the previous answer needs to fill extent by hand, since a better, automatic solution is:

go to Processing toolbox and call "Crop to data" SAGA (Raster Tools) process.

2
  • 1
    Just to clarify; the previous answer (by @Simbamangu) allows you to draw the target extent or enter numeric values.
    – danwild
    Commented Aug 15, 2017 at 5:11
  • 2
    This complained about conflicting versions and then failed. Commented May 2, 2021 at 19:35
2

A quick update to @Simbamangu's answer as of 2022.

  • In the current version of QGIS (I use 3.2x) click menu item Raster -> Extraction -> Clip Raster by Extent.
  • In the tool window that opens choose the raster layer you want to crop as Input layer (if not already chosen in your layer window).
  • Click the menu to the right of the Clipping extent input field (see screenshot).
  • Click and drag over your raster image (the selection box is almost invisible).
  • Set a filename and path under Clipped (extent)
  • Click Run.

enter image description here

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.