[gdal-dev] problem with unwanted white space in input file list for gdalbuildvrt

Fabrice LALLAURET - PSV fabrice.lallauret at external.thalesgroup.com
Wed Sep 15 04:05:36 EDT 2010


  Hi all,
I try to use some gdal tools in a batch file on windows and I've a 
strange side effect. Here is a little batch use with fwtools 2.4.7.

@echo off
echo "Test 1 with file list"
del listin.txt test1.vrt test2.vrt
for %%F in (krel*.tif) do @echo %%F>>  listin.txt
gdalbuildvrt  -input_file_list listin.txt test1.vrt
echo "Test 2 with direct argument"
gdalbuildvrt  test2.vrt krel*.tif

And then the result of this script.

H:\>testgdal.bat
"Test 1 with file"
0...10...20...30...40...50Warning 6: gdalbuildvrt does not support positive NS
resolution. Skipping krel31.tif
...60...70...80...90...100 - done.
Warning 6: gdalbuildvrt does not support positive NS resolution. Skipping krel32.tif
"Test 2 with direct argument"
0...10...20...30...40...50...60...70...80...90...100 - done.

The two input files are all correct and when I use this command line :


Everything works.

After some investigations,(check my file, gdal debug compilation, try on 
linux too, ...), I've found that there is a space at the end of each 
line in my listin.txt. On linux, the same thing produce a clear error :


#>  gdalbuildvrt -input_file_list listin.txt toto.vrt
0...10...20...30...40...50ERROR 4: `krel31.tif ' does not exist in the file system,
and is not recognised as a supported dataset name.
Warning 1: Warning : can't open krel31.tif . Skipping it
...60...70...80...90...100 - done.
ERROR 4: `krel32.tif ' does not exist in the file system,
and is not recognised as a supported dataset name.
Warning 1: Warning : can't open krel32.tif . Skipping it


It will be a good  thing that gdalbuildvrt trim white space before 
reading file or have the same error on windows and linux.

Thanks



More information about the gdal-dev mailing list