[gdal-dev] gdal2tiles for 16bit data

Jan Tosovsky j.tosovsky at email.cz
Mon Sep 22 13:18:08 PDT 2014


On 2014-09-21 David Strip wrote:
> On 9/20/2014 9:02 AM, Jan Tosovsky wrote:
> 
> > Adding an extra parameter seems to be fixing this:
> > dstile = self.mem_drv.Create('', self.tilesize, self.tilesize,
> > tilebands, gdal.GDT_UInt16)
> > (applied to all 'mem_drv.Create' occurrences)
> >
> > But the final tif has most likely incorrect metadata as its
> > reading via jai-imageio fails: 
> > ArrayIndexOutOfBoundsException: 256
> >
> > (Despite the Ok result when reading the tiling source image
> > using the same method)
> 
> Looking back at the code, the actual output file is created with 
> this line:
> self.out_drv.CreateCopy(tilefilename, dstile, strict=0)

Hmm, I have no idea how to pass this info into CreateCopy:
http://www.gdal.org/classGDALDriver.html

> If this still doesn't fix it, the first thing to do is run gdalinfo
> against one of the tiles and let us know the result.

Thanks for the hint. I've checked the tiling source (correct file):

...
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
...
Band 1 Block=256x256 Type=Int16, ColorInterp=Gray
  NoData Value=0


While my tile is:
...
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
...
Band 1 Block=256x8 Type=UInt16, ColorInterp=Gray
Band 2 Block=256x8 Type=UInt16, ColorInterp=Undefined

I've changed UInt16 to Int16, but in this case there are 'ERROR 1: Buffer
too small' errors when tiles are produced (but they are somehow generated
anyway). It fixes the type to Int16, but there are still some differences.

What exactly is 'Block=256x256' and is 'Block=256x8' in the second case
correct?
Are other differences cosmetic or fatal ones?

Thanks, Jan



More information about the gdal-dev mailing list