19

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?

  • 1
    somehow related gis.stackexchange.com/questions/10117/… – nadya Dec 24 '12 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 Jun 24 '13 at 17:50
26

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!

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.

  • Just to clarify; the previous answer (by @Simbamangu) allows you to draw the target extent or enter numeric values. – danwild Aug 15 '17 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.