Opened 13 years ago

Closed 9 years ago

#3328 closed enhancement (invalid)

gdalwarp doesn't support producing VRTs containing multiple source files

Reported by: EliL Owned by: warmerdam
Priority: lowest Milestone:
Component: Utilities Version: unspecified
Severity: trivial Keywords:


This is mostly copied from the email list (

Trying to mosaic multiple source files with gdalwarp to vrt format doesn't work properly.

gdalwarp -t_srs "EPSG:2913" -s_srs "EPSG:2994" -srcnodata "0 0 0" -dstnodata "0 0 0" -of VRT be44123g8b be44123g8c be44123g8a test2.vrt

Creating output file that is 11039P x 15191L. Processing input file be44123g8b.

test2.vrt looks fine with gdalinfo but not in OpenEv. Also, when I look in the .vrt file itself, I only see one reference to the 1 grid and not to the other 2 grids:

<SourceDataset relativeToVRT="1">be44123g8b</SourceDataset>

The same command using tif format works as expected:

gdalwarp -t_srs "EPSG:2913" -s_srs "EPSG:2994" -srcnodata "0 0 0" -dstnodata "0 0 0" -of GTIFF be44123g8b be44123g8c be44123g8a test2.tif

Creating output file that is 11039P x 15191L. Processing input file be44123g8b. 0...10...20...30...40...50...60...70...80...90...100 - done. Processing input file be44123g8c. 0...10...20...30...40...50...60...70...80...90...100 - done. Processing input file be44123g8a. 0...10...20...30...40...50...60...70...80...90...100 - done.

test2.tif looks fine with gdalinfo and in OpenEV.

I also notice that when processing to tif each of the 3 grids are listed. When processing to .vrt only 1 grid is listed.

This doesn't seem very important since Frank's Advice ("Or if the source files are all in the same coordinate system, perhaps you could build a mosaic vrt, and then use gdalwarp to produce a corresponding warped vrt.") worked quite well:

gdalbuildvrt gdalbuildvrt.vrt be44123g8a be44123g8b be44123g8c be44123h7 be44123h8a be44123h8b be44124g1 be44124h1 be45123a7 be45123a8 be45124a1
gdalwarp -t_srs "EPSG:2913" -s_srs "EPSG:2994" -of VRT gdalbuildvrt.vrt gdalbuildvrt2994.vrt

Change History (5)

comment:1 by Even Rouault, 13 years ago

Doesn't really improve the situation, but at least the user is warned :

r18564 /trunk/gdal/apps/gdalwarp.cpp: gdalwarp: print a warning message when trying to specify multiple source datasets as input of gdalwarp -of VRT

comment:2 by EliL, 12 years ago

Looking back on this, perhaps this should be closed as invalid or wontfix since the functionality is easily achieved with a slightly different approach. What do you think? Is there a good reason that gdalwarp should support -of VRT when the input is not VRT?

comment:3 by Even Rouault, 12 years ago

Yes we can close it. However your last sentence is not correct: gdalwarp does support warping something that is not a VRT into a VRT. What is not support is wrapping multiple non-VRT into VRT

comment:4 by Jukka Rahkonen, 9 years ago

Conclusion 3 years ago was that the ticket can be closed. Suggestion: close it now.

comment:5 by Even Rouault, 9 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.