2

I have a raster .tif Digital Elevation Model I am trying to clip to an irregular polygon using the GDAL\Clip raster by mask layer. I ticked 'Crop the extent of target dataset to extent of cutline'.

However, the output raster has the grid cells outside the mask layer cutline converted to 'Nodata' (apart from being annoying, it also retains the large file size of the source raster). I tried setting the destination nodata value to 'None', but this resulted in values of zero instead. (Please note that I do not know how to use the Commander/Python.) Any advice please?

processing.runalg("gdalogr:cliprasterbymasklayer","Input Raster", "Clip layer.shp",
                  "",False,True,False,5,4,75,6,1,False,0,False,"","Output raster")
1
  • 2
    This is normal behaviour, since raster data are defined by extent (rectangle by default) and cell size.
    – Oto Kaláb
    Jul 19, 2017 at 13:14

2 Answers 2

4

This is normal behaviour, since raster data are matrices defined by extent (rectangle by default) and cell size- resolution (each cell have same size) or number of columns and rows in extent.

0

I'm having the same problem with QGIS 3.16. I overcome this by setting nodata value to some number out of bounds (eg. -99999) and delete them manually after exporting the XYZ data. However, I don't understand why this is happening. There exist abundant data points in the vicinity of the clip mask (inside and outside). I've also tried reprojecting the clip mask polygon to the same CRS with the raster layer, still not working...

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 14 at 17:53
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review Feb 14 at 17:56

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.