[Gdal-dev] VRTWarpedDataset w/ -dstalpha

Dardo D Kleiner - CONTRACTOR dkleiner at cmf.nrl.navy.mil
Fri May 20 13:38:18 EDT 2005


So I have a set of source imagery in a particular non-WGS84 projection that I
want to convert to a set of raw tiles in WGS84.  I figured I could make use
of the fantastic VRT format to minimize the number of stages required.  So I
build a "layered" vrt tree like this (forgive the ASCII art):

[src1.tif] [src2.tif] [src3.tif] . . . [srcN.tif] (say, 10k x 10k images)
     |          |          |                |
[src1.vrt] [src2.vrt] [src3.vrt] . . . [srcN.vrt] (add georeferencing)
     \          \          /                /
      \          \        /                /
       \          \      /                /
        \---------[src.vrt]--------------/ (i.e. a vrt mosaic)
                      |
                      | gdalwarp -of vrt -s_srs EPSG:xxxx -t_srs EPSG:4326 \
                      |       -co ALPHA=YES -dstalpha src.vrt dest.vrt
                      |
        /---------[dest.vrt]-------------\
       /           /     \                \
      /           /       \                \
     /           /         \                \
[dest1.vrt] [dest2.vrt] [dest3.vrt] . . . [destM.vrt] (512 x 512 tile grid)
     |           |           |                 |
[dest1r.vrt] [dest2r.vrt] [dest3r.vrt] . . . [destMr.vrt] (VRTRawRasterBand)
     |           |           |                 |
[dest1.8888] [dest2.8888] [dest3.8888] . . . [destM.8888] (raw tiles)

I'd like to just be able to run a pass over the dest? files doing
'gdalwarp -of vrt dest?.vrt dest?r.vrt' and have the dest?.8888 files
"magically" created.  In the GDAL Virtual Format Tutorial it says "The
VRTRawRasterBand supports in place update of the raster, whereas the source
based VRTRasterBand is always read-only.", which leads me to believe that I
can write to a vrt that has VRTRawRasterBand.  And gdalwarp says "Mosaicing
into an existing output file is supported if the output file already exists."

I've encountered two problems.

1) When I try to access dest.vrt (say, gdal_translate dest.vrt dest.tif), I
get alot of these errors:

ERROR 6: WriteBlock() not supported for this dataset.

and the resulting image is "wrong", in that the color is very "blue".  If I
don't use "-co ALPHA=YES -dstalpha" the output is "correct".  But I need the
alpha channel to avoid displaying the black edges that result from the warp
operation.

2) When I try to 'gdalwarp -of vrt dest?.vrt dest?.raw' it always overwrites my
raw files with a new VRTWarpedDataset definition, rather than writing "into"
the existing raw VRT and producing the raw tile output file.

Is what I'm attempting supported?  On a more philosophical level, is it insane?

Thanks for any help!
- Dardo




More information about the Gdal-dev mailing list