[gdal-dev] Mosaic to vrt format with gdalwarp

Frank Warmerdam warmerdam at pobox.com
Fri Jan 15 23:29:31 EST 2010


Eli Adam wrote:
> Hi all, I'm having some trouble using gdalwarp to mosaic ArcInfo Binary Grid
> files to vrt.
> 
> Here is what I want to do and works in .tif.  I mosaic the three grids be...
> to test2.tif: 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.
> 
> 
> That works how I want.  However, I have many more than 3 grids and can't
> create an output file that large.  So I use vrt which has been very useful
> to me in the past: 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>
> 
> I also notice that when processing to tif each of the 3 grids are listed.
> When processing to .vrt only 1 grid is listed.
> 
> I read up on vrt here, http://www.gdal.org/gdal_vrttut.html to try and
> manually create/edit a vrt file but my preliminary tries weren't successful.
> 
> 
> Let me know if you need any additional information on this or have any
> ideas.

Eli,

I am afraid that gdalwarp just doesn't support producing VRTs containing 
multiple source files. It would, I think, be reasonably challenging to
correct  - not just a quick bug fix.  You could file a ticket on it.

You could do two steps, gdalwarp each independently to TIFF, and then
use something like gdalbuildvrt to build a mosaic vrt.  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.

I will say that this is pushing the VRT mechanism fairly far and the
efficiency of the resulting layers of vrt may not be that great.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list