I follow the instructions here very closely and yet every time QGIS gets caught in a loop. It takes a few small rasters totally less than 100mb and creates HUGE gb files and will not stop until python.exe is killed in task manager.

From one of the ecw's metadata :

Driver GDAL provider ECW ERDAS Compressed Wavelets (SDK 5.0) Dataset Description E:/work/1680_U/aerials/1680_naip/global_mapper/defbri_gm/500ft_clips/87.ecw COLORSPACE=MULTIBAND COMPRESSION_RATE_TARGET=1 VERSION=2 Band 1 Band 2 Band 3 Band 4 Dimensions X: 36702 Y: 14147 Bands: 4 X : 18351,Y 7073 X : 9175,Y 3536 X : 4587,Y 1768 X : 2293,Y 884 X : 1146,Y 442 X : 573,Y 221 Origin 614731,4.61751e+06 Pixel Size 1,-1 No Data Value *NoDataValue not set* Data Type Byte - Eight bit unsigned integer Pyramid overviews Layer Spatial Reference System +proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs Layer Extent (layer original source projection) 614730.9328588016796857,4603364.5349677717313170 : 651432.9328588016796857,4617511.5349677717313170 Band Band 1 Band No 1 No Stats No stats collected yet Band Band 2 Band No 2 No Stats No stats collected yet Band Band 3 Band No 3 No Stats No stats collected yet Band Band 4 Band No 4 No Stats No stats collected yet

  • Are your rasters adjacent without lot of empty space in between of them? – user30184 Nov 24 '14 at 18:49
  • 2
    Post details about the rasters, i.e gdalinfo reports. – user2856 Nov 24 '14 at 20:56
  • They are NAIP aerials (.sid or .ecw or .tif) sometimes with overlap and usually no empty space in between them. – sirgeo Nov 24 '14 at 20:56
  • 1
    can you please elaborate on how to run gdalinfo reports? – sirgeo Nov 24 '14 at 21:07
  • 2
    You don't run it in QGIS, you run it in a command prompt. Don't worry about it, just post the text copied from the QGIS layer properties dialog -> metadata tab -> properties text - i.e. imgur.com/CJr015W (note, post the text, not a screenshot and edit your question to include this, don't post it in a comment) – user2856 Nov 26 '14 at 1:10

I doubt your process "gets caught in a loop", I think it will just take a long time to complete as your rasters are actually quite large.

Those "small rasters totally less than 100mb" are roughly 2Gb uncompressed, each. The layer properties you included in your question show that particular raster has dimensions of 36702 cols, 14147 rows and 4 bands with an 8 bit (1 byte) data type. Therefore the uncompressed size of the raster is 36702*14147*4 bytes (1980.7 Mb).

ECW compression is quite effective...

Last year I was doing something similar and ended up with an output tiff which would have been 2TB if I did not use compression. The process took about a week to complete.

A couple of options:

  1. In the merge dialog, make sure "creation options" is checked and select JPEG compression as the profile.

    • This will still take a long time and won't give quite as good compression rate as ECW.
    • You can get even better compression if you add another row to the creation options with name=PHOTOMETRIC and value=YCBCR, but JPEG YCBCR only works for three band images so you would have to extract the RGB or CIR bands first (i.e using a VRT).
    • Note that JPEG compression is lossy (as is ECW), but you will get better compression than with lossless compression methods such as DEFLATE and LZW.
  2. Leave your rasters in ECW format and build a Virtual Raster (catalog).

    • This is the option above merge in the QGIS Raster->Miscellaneous menu.
    • This is my recommendation as the Virtual Raster is a simple text (xml) file that points to the original ECWs, so it takes up practically no disk space and will only take a few seconds to generate.

ECW comes from Erdas and is not fully supported by GDAL without Erdas licence. According to the help :

The ECW 4.x SDK from ERDAS is only free for image decompression. To compress images it is necessary to build with the read/write SDK and to provide an OEM licensing key at runtime which may be purchased from ERDAS.

So you can decompress your image, but not recompress it in the same format, which is likely to be the reason why you end up with huge image on disk. You could however select another output type (e.g. tif), and set the compression type to DEFLATE or LZW (better, but less stable from my experience).

the other solution I propose is to create a vrt: those virtual file will create the mosaic that you can read in QGIS without creating a new image file, but it will behave like a mosaic for analysis.

  • The current GDAL ecw driver is read-only, so you can not write any output in that format, compressed or uncompressed. – AndreJ Dec 2 '14 at 10:58

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.