How can I clip my DEM raster in a irregular shape in QGIS?

I have used the clipping tool but it only does rectangles I believe.

  • You can use a polygon layer with totally irregular shape, like a state boundary. The only thing is you have to define the value of no data values for pixels outside the boundary May 16 '17 at 16:36
  • how do I do what you just described? I do not need a state boundary but I have to create my own custom shape.
    – MrCarbon
    May 16 '17 at 16:46

Within QGIS you can use the 'clipper' tool in Raster > Extraction > Clipper. Alternatively, you can use the gdalwarp command line utility if you have this installed (this is what QGIS will run on your behalf).

gdalwarp -of GTiff -cutline shapefile.shp -crop_to_cutline input.tiff output.tiff
  • the regular clipping tool does irregular shapes?
    – MrCarbon
    May 16 '17 at 20:43
  • It should do, provided you tick the 'crop the extent of the target dataset to the extent of the cutline' box. You will have to select 'Mask Layer' before this tick box appears. May 17 '17 at 0:30
  • I tried it but I didn't understand how to draw my desired shape
    – MrCarbon
    May 17 '17 at 16:28
  • Go to Layer > create Layer > New Shapefile Layer. When the tool appears, choose polygon. name it and change the type to whole number. Click OK. Save the shapefile. Look for a tool on the toolbar that looks like a pencil. click this. next to it is 'add feature' tool. select this and draw your shapefile by clicking the left mouse button. When finished, click the right mouse button and enter the number 1 in the box. Click the pencil again to save your edits. You now have a shapefile. detailed instructions: docs.qgis.org/2.8/en/docs/training_manual/create_vector_data/… May 17 '17 at 16:36

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.