[gdal-dev] Mosaic to vrt format with gdalwarp

Eli Adam EAdam at co.lincoln.or.us
Sat Jan 16 01:00:41 EST 2010


Frank and John,

Thanks for the suggestions.  I did take the advice to use gdalbuildvrt and then warp that:

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

I forgot to mention this in the first email, but the step I was wanting to do next was to tile it with gdal_translate (although on different tiles than the original tiles): 
gdal_translate -projwin 7288440 446648 7306569 429923 gdalbuildvrt2994.vrt NewTile.tif
etc...

So the performance hit is well worth it for letting it run slowly through vrt once.  This does exactly what I want and having to add the gdalbuildvrt step is not much additional effort.  The only thing that it didn't do that I wanted was -srcnodata and -dstnodata, however, it looks like that will be available in 1.7, right around the corner.

I also opened a ticket on this in case someone else looks for it.
http://trac.osgeo.org/gdal/ticket/3328

Thanks, Eli



>>> "John C. Tull" <jctull at gmail.com> 1/15/2010 9:30 PM >>>
On Jan 15, 2010, at 8:29 PM, Frank Warmerdam wrote:

> 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.

I would simply second Frank's final comment. When using a warped vrt, your computer has to go through the computational requirements to do the warp every time you load the vrt in a GIS or spatial data viewing software. This will grow tiresome real quickly. I have tried this myself before and determined that sacrificing hard drive space was preferable to sacrificing cpu cycles repeatedly.

Regards,
John

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org 
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list