[gdal-dev] GDAL2TILES - tiles background color

Klokan Petr Přidal klokan at klokan.cz
Wed Jul 9 07:22:08 EDT 2008


Hello folks,

I was discussing this problem with Gianni, he is using GDAL2Tiles for
publishing aerial imagery in a project for Italian government.
The problem was not in the GDAL2Tiles application but in the input
data. That raster had white nodata areas, but it was in loosy
compression (ECW), so I suggested this workflow, which runs well:

nearblack -white -o stintino.tif stintino.ecw
gdalwarp -srcnodata 255 -dstalpha stintino.tif stintino-with-alpha.tif
gdal2tiles stintino-with-alpha.tif

- First step is generating real white in the almost white areas (ECW is
uses loosy compression so white is not 255,255,255 but sometimes
252,254,255 etc.)

- Second step converts the raster with real white (RGB) to raster with
transparency - gdalinfo tells you: 4 bands (RGBA)

- Third is generation of the tiles from file with transparency..

For Google Earth overlay tiles you need to specify in the third step
(gdalwarp) the projection of Google Earth, e.g. "-t_srs epsg:4326".

Just in case somebody will have similar problems, to have a solution
in conference archive...

Best regards

Klokan

BTW Is there any plan to add -dstalpha (generation of alpha channel)
to nearblack utility?

On Wed, Jun 18, 2008 at 7:36 AM, Gianni Barrotta
<giannibarrotta at gmail.com> wrote:
> Hi list,
> I need some advice on gdal2tiles; I need to customize the background color
> for tiles, now gdal2tiles generate white  color in the nodata border for
> maps with width and height not modulo 256.
> I've read in this ticket:
> http://trac.osgeo.org/gdal/ticket/1763
> that the nodata value should be selectable, but I can't find a way to do so.
> Could you please help me?
> Thank's.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list