0

This question already has an answer here:

I am working on large raster in QGIS and I am doing various simulations on them. There is one thing that I don't understand.

I have a large raster (111 072 kb) that I clip to only have the values I'm interested in. The new raster only retains 3% of the values from the original raster. When I look at the values in QGIS, everything seems right. The values that I clipped have the good values and outside it's only a No data area (which is what I want). However, the clipped raster is still pretty heavy for the amount of value it has (85 596 kb), so approximately 77% of the size of the original raster.

Why is the clipped raster still so heavy and not more or less 3% of the original file size?

marked as duplicate by user30184, whyzar, Andre Silva, Community Oct 31 '18 at 7:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You most likely chose TIFF as you output format? Tiff has next to none compression, unlike jpg, therefore your data still is huge. – Erik Oct 30 '18 at 14:21
  • Yes this is a TIFF and I understand why it is heavy but I don't understand how No data can wheigh something. If I convert to jpg everything will be compressed. – C.Serrano Oct 30 '18 at 14:24
  • Tiffs store value for each pixel separately. Even if the value is "no data", the Tiff-structure writes this down for each pixel. You omit two data-"notes" per pixel (RGB --> one value), but still your image is quite storage-heavy. – Erik Oct 30 '18 at 14:40
  • Then is there a way to avoid this ? Because of this my simulation are rendered super slowly. – C.Serrano Oct 30 '18 at 14:50
  • Yeah, don't save as a tiff. This is inherent to the picture types algorithm, you can't avoid it if you want to use tiff. – Erik Oct 30 '18 at 14:53
0

I am not sure how you clipped your raster data, but my advice if you want to reduce the size of the raster, it is better to create a polygon shapefile of the study area, and use it as a clipping mask layer, and check Crop the extent of the target dataset to the extent of the cutline

enter image description here

The output of raster size will be reduced. However, you have to make sure that both raster data and polygon data have the same projection.

  • Thanks but this does not change anything. As a raster is always square, even if it is croped to the extent of the cutline, there is still plenty of pixels with no data. The problem is the wheigh of those remainings No data cells. – C.Serrano Oct 30 '18 at 14:48
  • @C.Serrano I forgot one step that you need to specify Nodata as -9999. I updated my answer. The original size of the raster is about 25 mb. The clipped raster is about 800 kb which is reduced significantly. – ahmadhanb Oct 30 '18 at 14:56
  • It still does not change with the -9999 setting. The wheigh is reduced but I still have the same sizes as exposed previously. – C.Serrano Oct 30 '18 at 15:10
  • Can you show us your image how it looks like? – ahmadhanb Oct 30 '18 at 15:10
  • I can't for legal reasons (I am not allowed to share it). But I think Erik int the comments above gave a fair explanation. – C.Serrano Oct 30 '18 at 15:23

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