[Gdal-dev] gdal_vrtmerge,
gdal_merge: wrong rasterYSize in output VRT
Maciej Sieczka
tutey at o2.pl
Thu Oct 18 14:12:43 EDT 2007
Hi,
The input is thousands of tiles, each 250x250 cells, which I
want to merge into one VRT dataset for further processing.
The problem is that when the number of input tiles is
greater than about 4710, commands "gdal_merge -of VRT
-createonly" and gdal_vrtmerge.py [1] calculate
"rasterYSize" of the output VRT wrong. However, the same
input and syntax work OK when the output format is GeoTIFF.
EXAMPLE
Files list1 and list2 contain input tiles filenames, all in
one line, space separated.
When 4711 tiles are input all is fine:
$ wc -w list1
4711 list1
$ cat list1 | xargs gdal_merge.py -createonly -of VRT -o
list1.vrt
$ head -n1 list1.vrt
<VRTDataset rasterXSize="50250" rasterYSize="6000">
6000 is correct.
But, one tile more and rasterYSize goes funky:
$ wc -w list2
4712 list2
$ cat list2 | xargs gdal_merge.py -createonly -of VRT -o
list2.vrt
$ head -n1 list2.vrt
<VRTDataset rasterXSize="250" rasterYSize="250">
Like if some "rasterYSize counter reset" happened. Strange.
Yet, it's even stranger that the output VRT filename length
has something to do with it - using the "list1", which
worked OK above, but requesting the output VRT filename 16
chars longer, yields the same "rasterYSize counter reset":
$ cat list1 | xargs gdal_merge.py -createonly -of VRT -o
list101234567890123456.vrt
$ head -n1 list101234567890123456.vrt
<VRTDataset rasterXSize="250" rasterYSize="250">
^
|
If output name is shorter than 16
chars, this is "6000" (correct)!
At first I thought that maybe xargs (using it to avoid the
"Argument list too long" error) does something wrong, but
why does the same input and syntax that fails for VRT, work
OK for GeoTIFF (ie. the number of cells in Y axis is 6000) then:
$ cat list2 | xargs gdal_merge.py -createonly -of GTIFF -o
list2.tif
$ cat list1 | xargs gdal_merge.py -createonly -of GTIFF -o
list101234567890123456.tif
$ gdalinfo list2.tif | grep "Size is "
Size is 50250, 6000
^
|
Correct. Respective VRT had "250" though.
$ gdalinfo list101234567890123456.tif | grep "Size is "
Size is 50250, 6000
^
|
Correct. Respective VRT had "250" though.
???
Moreover, creating a GeoTIFF from all 40401 tiles I'd like
to merge, fails in a peculiar way too:
There are really 40401 adjacent 250x250 tif tiles:
$ find . -type f -name \*.tif | wc -l
40401
$ find . -type f -name \*.tif -exec gdal_merge.py -of GTIFF
-createonly -o ~/all_createonly.tif {} +
$ gdalinfo ~/all_createonly.tif | grep "Size is"
Size is 50250, 23750
^
|
This should be "50250".
Thoughts?
Using GDAL 1.4.2 SVN 2007-09-12. I could reproduce this all
with FWTools-linux-1.3.5.tar.gz too.
[1]http://www.vso.cape.com/~nhv/files/gdal/gdal_vrtmerge.py
Maciek
More information about the Gdal-dev
mailing list