[gdal-dev] Problem to merge 2 images

Even Rouault even.rouault at mines-paris.org
Fri Aug 26 10:42:47 EDT 2011


Selon Chaitanya kumar CH <chaitanya.ch at gmail.com>:

> Jan,
>
> The first error message is because of the block size. The entire image is
> taken as a block; not good for large rasters. When copying, GDAL tries to
> load the entire block into the memory.
>
> It's very likely that the problem will be resolved if we create copies of
> the gtiffs with smaller blocks. Use gdal_translate with the -co option[1] to
> set the BLOCKXSIZE and BLOCKYSIZE [2] of the output image. Since the
> datatype of the gtiffs is byte set them both to 1024. Decrease it to 512 or
> 256 if the problem persists.

Yes, I share your analysis, but it might be impossible to use gdal_translate of
FWTools to do that since the limitation will be the same : you must have enough
RAM to load the single block into memory.

There have been improvements in the GTiff driver in versions more recent that
the one shipped with FWTools, which, when used with the internal libtiff, make
those one-single-strip compressed files viewed as standard stripped file. As
FWTools 2.4.7 corresponds to a pre-1.6 version and its production is now
discontinued, you might want to explore the alternatives presented in the
Windows section of http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries that
ship with updated versions.

>
> [1]: http://www.gdal.org/gdal_translate.html
> [2]: http://www.gdal.org/frmt_gtiff.html
>
> On Fri, Aug 26, 2011 at 6:31 PM, Jan Tappenbeck
> <tappenbeck at widemann.de>wrote:
>
> >
> >
> >  hi !
> >
> > i have got two images to merge and convert into ecw - but i only get a
> > error-message and a black image.
> >
> > i send following command:
> >
> >
> > gdal_merge.bat -of GTiff -o
> D:/GDAL_Projekte/xxxxxxxxxx/**xxxxxxxxxx_gesamt.tif
> > D:/GDAL_Projekte/xxxxxxxxxx/**xxxxxxxxxx_300_nord_geo.tif
> > D:/GDAL_Projekte/xxxxxxxxxx/**xxxxxxxxxx_300_sued_geo.tif
> >
> > gdal_translate -of ECW -co LARGE_OK=YES
> D:/GDAL_Projekte/xxxxxxxxxx/**xxxxxxxxxx_gesamt.tif
> > D:/GDAL_Projekte/xxxxxxxxxx/**xxxxxxxxxx_gesamt.ecw
> >
> > and here are the image-infos and the message - can anybody help me?
> >
> > reagards Jan :-)
> >
> > C:\Program Files (x86)\FWTools2.4.7>gdalinfo D:/GDAL_Projekte/XXXXXXX/**
> > XXXXXXX_
> > 300_nord_geo.tif
> > Driver: GTiff/GeoTIFF
> > Files: D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_300_nord_geo.tif
> >       D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_300_nord_geo.tfw
> > Size is 25848, 19395
> > Coordinate System is:
> > PROJCS["unnamed",
> >    GEOGCS[,
> >        DATUM["unknown",
> >            SPHEROID["unretrievable - using WGS84",6378137,298.257223563]]*
> > *,
> >        PRIMEM["Greenwich",0],
> >        UNIT[,0.0174532925199433]],
> >    UNIT["unknown",1]]
> > Origin = (3551283.342142190800000,**5917001.142321675100000)
> > Pixel Size = (0.423322208955370,-0.**423342973054873)
> > Metadata:
> >  TIFFTAG_SOFTWARE=WGEO 3.0.0.69 VKB KAWinsen2
> >  TIFFTAG_XRESOLUTION=300
> >  TIFFTAG_YRESOLUTION=300
> >  AREA_OR_POINT=Area
> > Image Structure Metadata:
> >  COMPRESSION=PACKBITS
> >  INTERLEAVE=BAND
> >  MINISWHITE=YES
> > Corner Coordinates:
> > Upper Left  ( 3551283.342, 5917001.142)
> > Lower Left  ( 3551283.342, 5908790.405)
> > Upper Right ( 3562225.375, 5917001.142)
> > Lower Right ( 3562225.375, 5908790.405)
> > Center      ( 3556754.358, 5912895.774)
> > Band 1 Block=25848x19393 Type=Byte, ColorInterp=Palette
> >  Image Structure Metadata:
> >    NBITS=1
> >  Color Table (RGB with 2 entries)
> >    0: 255,255,255,255
> >    1: 0,0,0,255
> >
> > C:\Program Files (x86)\FWTools2.4.7>gdalinfo D:/GDAL_Projekte/XXXXXXX/**
> > XXXXXXX_
> > 300_sued_geo.tif
> > Driver: GTiff/GeoTIFF
> > Files: D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_300_sued_geo.tif
> >       D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_300_sued_geo.tfw
> > Size is 25849, 19394
> > Coordinate System is:
> > PROJCS["unnamed",
> >    GEOGCS[,
> >        DATUM["unknown",
> >            SPHEROID["unretrievable - using WGS84",6378137,298.257223563]]*
> > *,
> >        PRIMEM["Greenwich",0],
> >        UNIT[,0.0174532925199433]],
> >    UNIT["unknown",1]]
> > Origin = (3551215.913367207200000,**5909585.856755478300000)
> > Pixel Size = (0.423327969973589,-0.**423338937597159)
> > Metadata:
> >  TIFFTAG_SOFTWARE=WGEO 3.0.0.69 VKB KAWinsen2
> >  TIFFTAG_XRESOLUTION=300
> >  TIFFTAG_YRESOLUTION=300
> >  AREA_OR_POINT=Area
> > Image Structure Metadata:
> >  COMPRESSION=PACKBITS
> >  INTERLEAVE=BAND
> >  MINISWHITE=YES
> > Corner Coordinates:
> > Upper Left  ( 3551215.913, 5909585.857)
> > Lower Left  ( 3551215.913, 5901375.621)
> > Upper Right ( 3562158.518, 5909585.857)
> > Lower Right ( 3562158.518, 5901375.621)
> > Center      ( 3556687.216, 5905480.739)
> > Band 1 Block=25849x19393 Type=Byte, ColorInterp=Palette
> >  Image Structure Metadata:
> >    NBITS=1
> >  Color Table (RGB with 2 entries)
> >    0: 255,255,255,255
> >    1: 0,0,0,255
> >
> > C:\Program Files (x86)\FWTools2.4.7>D:\GDAL_**Projekte\XXXXXXX\XXXXXXX.bat
> >
> > C:\Program Files (x86)\FWTools2.4.7>gdal_merge.**bat -of GTiff -o
> > D:/GDAL_Projekte
> > /XXXXXXX/XXXXXXX_gesamt.tif D:/GDAL_Projekte/XXXXXXX/**
> > XXXXXXX_300_nord_geo.ti
> > f D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_300_sued_geo.tif
> > ERROR 4: `D:/GDAL_Projekte/XXXXXXX/**XXXXXXX_gesamt.tif' not recognised as
> > a sup
> > ported file format.
> >
> > 0ERROR 2: GDALRasterBlock::Internalize : Out of memory allocating 501270264
> > byte
> > s.
> > ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 1
> > Traceback (most recent call last):
> >  File "C:\PROGRA~2\FWTOOL~1.7\bin\**gdal_merge.py", line 472, in ?
> >    sys.exit(main())
> >  File "C:\PROGRA~2\FWTOOL~1.7\bin\**gdal_merge.py", line 459, in main
> >    fi.copy_into( t_fh, band, band, nodata )
> >  File "C:\PROGRA~2\FWTOOL~1.7\bin\**gdal_merge.py", line 231, in copy_into
> >    nodata_arg )
> >  File "C:\PROGRA~2\FWTOOL~1.7\bin\**gdal_merge.py", line 62, in
> > raster_copy
> >    t_xsize, t_ysize, t_band.DataType )
> >  File "C:\PROGRA~2\FWTOOL~1.7\pymod\**gdal.py", line 851, in ReadRaster
> >    buf_xsize, buf_ysize,buf_type)
> > TypeError: GetBlockRef failed at X block offset 0, Y block offset 1
> >
> > ______________________________**_________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> >
>
http://lists.osgeo.org/**mailman/listinfo/gdal-dev<http://lists.osgeo.org/mailman/listinfo/gdal-dev>
> >
>
>
>
> --
> Best regards,
> Chaitanya kumar CH.
>
> +91-9494447584
> 17.2416N 80.1426E
>




More information about the gdal-dev mailing list