[gdal-dev] Converting ecw to tif for Geoserver

Paul Meems bontepaarden at gmail.com
Sat Feb 9 04:48:13 PST 2013

The last days I've been trying to convert my ecw file to a GeoTiff so I can
use it in Geoserver.
The ecw is a mozaik of aerial photos.
When I do these two commands it is working in Geoserver:

   - gdal_translate -of GTiff -co tiled=yes -co compress=jpeg -co
   photometric=YCBCR -a_srs EPSG:28992 -co "BLOCKXSIZE=512" -co
   "BLOCKYSIZE=512" my.ecw my.tif
   - gdaladdo -r average --config COMPRESS_OVERVIEW JPEG --config
   PHOTOMETRIC_OVERVIEW YCBCR  my.tif 2 4 8 16 32 64 128

But I want to add a second reference layer beneath this one which is
larger. The translated ecw has white edges, so that is not looking nice.
I've asked about this before and suggested was to use a cutline. So I
create a polygon that is inside the ecw file and ran this command:

   - gdalwarp -multi -cutline "clip.shp" -of GTiff -co tiled=yes -co
   compress=jpeg -co photometric=YCBCR -co "BLOCKXSIZE=512" -co
   "BLOCKYSIZE=512" -s_srs EPSG:28992 -r lanczos -overwrite my.ecw clipped.tif

When I open clipped.tif in MapWindow I can see the white edges are gone.
But when I call *gdaladdo* white artifacts are back again.
I'm now in the process of calling *nearblack* on both my.tiff and
clipped.tif but I'm not sure I'm doing it right. I think I'm using the
correct commands but perhaps in the wrong order.
The ecw file isn't very large (2.6GB) but all steps take a long time,
especially *nearblack *which is running for 4 hours now and is just at 10%.

Does anybody have some suggestions how to process the steps to convert an
ecw file which has white outside areas to a transparent tif file with

I'm running the latest GDAL v1.10 version from Tamas on Windows Vista on a
8GB 4core machine. Speed is not a big issue when I know the result will be


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130209/5728241b/attachment.html>

More information about the gdal-dev mailing list