<div dir="ltr"><div>Can you share the output of gdalinfo of your original file?</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">karsten <<a href="mailto:karsten@terragis.net">karsten@terragis.net</a>> escreveu no dia sábado, 13/06/2020 à(s) 00:13:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>



<div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080">Hi Pedro,</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080"></font></span> </div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080">using your suggestion I came up with this command 
:</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080"></font></span> </div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080">gdal_translate -co COMPRESS=DEFLATE -co PREDICTOR=2 -co 
ZLEVEL=9 -ot Byte -of GTiff -tr 1.0 -1.0 -a_nodata 0 input.tif 
output.tif</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080"></font></span> </div>
<div dir="ltr" align="left"><span><font size="2" face="Arial" color="#000080">and got the 5GB file cut result raster from before down to 43 
MB !</font></span></div>
<div dir="ltr" align="left"><span></span> </div>
<div dir="ltr" align="left"><span></span><span></span><font face="Arial"><font color="#000080"><font size="2">T<span>h</span><span>a</span><span>nks</span></font></font></font></div>
<div dir="ltr" align="left"><span></span><span></span><font face="Arial"><font color="#000080"><font size="2">K<span>arsten</span></font></font></font><br></div>
<div dir="ltr" lang="en-us" align="left">
<hr>
<font size="2" face="Tahoma"><b>From:</b> Pedro Venâncio 
[mailto:<a href="mailto:pedrongvenancio@gmail.com" target="_blank">pedrongvenancio@gmail.com</a>] <br><b>Sent:</b> Friday, June 12, 2020 
13:19<br><b>To:</b> karsten<br><b>Cc:</b> QGIS User<br><b>Subject:</b> Re: 
[Qgis-user] clip raster by mask layer (gdalwarp with -cutline option) enormously 
bloats file size<br></font><br></div>
<div></div>
<div dir="ltr">
<div>Hi Karsten,</div>
<div><br></div>
<div>First you have to ensure that the output data type is also Byte:</div>
<div>-ot Byte</div>
<div><br></div>
<div>Second, your original raster must be some kind of compression. You can see 
it with gdalinfo. So, you need to apply compression to the output file, for 
instance with: 
<p style="white-space:pre-wrap;margin:0px;text-indent:0px">-co 
COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9</p>
<p style="white-space:pre-wrap;margin:0px;text-indent:0px"><br></p>
<p style="white-space:pre-wrap;margin:0px;text-indent:0px">Best 
regards,</p>
<p style="white-space:pre-wrap;margin:0px;text-indent:0px">Pedro 
Venâncio</p>
<p style="white-space:pre-wrap;margin:0px;text-indent:0px"><br></p></div></div><br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">karsten <<a href="mailto:karsten@terragis.net" target="_blank">karsten@terragis.net</a>> escreveu no dia 
sexta, 12/06/2020 à(s) 21:09:<br></div>
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)"><u></u>
  <div>
  <div><font size="2" face="Arial" color="#000080"><span>Hi All,</span></font></div>
  <div> </div>
  <div><font size="2" face="Arial" color="#000080"><span>I have a large *.tif raster 
  data set ( 92000 * 69000 cells of one meter, projection EPSG:25832 - ETRS89 / 
  UTM zone 32N )<br>It contains integer values 1 to 20 and has a file size 
  of  about 100 MB  in "Byte - Eight bit unsigned integer" 
  format. <br>Now the result is a rectangle and I wanted to cut it down to 
  the area of interest (via cutline gdal option) using a shape polygon file 
  (with one continuous polygon inside) to and set all values outside the area of 
  interest of that rectangle to NULL values (for example setting 0 as 
  NULL data values). I used the QGIS ( QGIS v 3.12 on windows) Menu RASTER 
  > Extraction > Clip Raster by mask Layer which is based on 
  gdalwarp.<br></span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span>That is when I am 
  running into the problem that the 'cut' file size increases enormously and I 
  ended up wit 50 times bigger file ( 5 GB size ! ) when I was actually 
  expecting a smaller file size than before.</span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span>I have not really 
  an idea why the file becomes so enormously bloated. The same is the 
  cass when I try gdalwarp directly on the command line or when using the QGIS 
  Raster calculator or any other method I tried so far.</span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span></span></font> </div>
  <div><font size="2" face="Arial" color="#000080"><span>How can I manage to get a 
  smaller file size ( aka the 100 MB file size I started of with ) and which 
  tools or formats are recommended  to achieve this ?</span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span>Cheers</span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span>Karsten</span></font></div>
  <div><font size="2" face="Arial" color="#000080"><span></span></font> </div>
  <div><span style="font-size:11pt;font-family:"Verdana","sans-serif"">Karsten 
  Vennemann<br></span><span style="font-size:9pt;font-family:"Verdana","sans-serif""><span style="color:rgb(0,50,100)"><a title="http://www.terragis.net/
blocked::http://www.terragis.net/" href="http://www.terragis.net" target="_blank"><font title="http://www.terragis.net/" color="#0000ff">www.terragis.net</font></a></span></span><u></u><u></u><u></u></div>
  <div align="left">
  <div align="left"><font size="2" face="Arial" color="#000080"></font> </div></div></div>_______________________________________________<br>Qgis-user 
  mailing list<br><a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>Unsubscribe: 
  <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div></div>
</blockquote></div>