[Qgis-user] clip raster by mask layer (gdalwarp with -cutline option) enormously bloats file size
Pedro Venâncio
pedrongvenancio at gmail.com
Fri Jun 12 16:15:24 PDT 2020
Can you share the output of gdalinfo of your original file?
karsten <karsten at terragis.net> escreveu no dia sábado, 13/06/2020 à(s)
00:13:
> Hi Pedro,
>
> using your suggestion I came up with this command :
>
> 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
>
> and got the 5GB file cut result raster from before down to 43 MB !
>
> Thanks
> Karsten
> ------------------------------
> *From:* Pedro Venâncio [mailto:pedrongvenancio at gmail.com]
> *Sent:* Friday, June 12, 2020 13:19
> *To:* karsten
> *Cc:* QGIS User
> *Subject:* Re: [Qgis-user] clip raster by mask layer (gdalwarp with
> -cutline option) enormously bloats file size
>
> Hi Karsten,
>
> First you have to ensure that the output data type is also Byte:
> -ot Byte
>
> 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:
>
> -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9
>
>
> Best regards,
>
> Pedro Venâncio
>
>
>
> karsten <karsten at terragis.net> escreveu no dia sexta, 12/06/2020 à(s)
> 21:09:
>
>> Hi All,
>>
>> I have a large *.tif raster data set ( 92000 * 69000 cells of one meter,
>> projection EPSG:25832 - ETRS89 / UTM zone 32N )
>> It contains integer values 1 to 20 and has a file size of about 100 MB
>> in "Byte - Eight bit unsigned integer" format.
>> 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.
>> 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.
>> 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.
>>
>> 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 ?
>> Cheers
>> Karsten
>>
>> Karsten Vennemann
>> www.terragis.net
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200613/840378de/attachment.html>
More information about the Qgis-user
mailing list