[Gdal-dev] VRTWarpedDataset w/ -dstalpha
Frank Warmerdam
fwarmerdam at gmail.com
Fri May 20 13:52:15 EDT 2005
On 5/20/05, Dardo D Kleiner - CONTRACTOR <dkleiner at cmf.nrl.navy.mil> wrote:
> 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.
Dardo,
I'm not sure I follow your whole tree of .vrt's concept properly. Is dest.vrt
using a bunch of <SimpleSource>'s to refer to individual tiles? You should
be able to read from such a thing, but you cannot write to it.
> 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.
Try not including the "-of vrt" part. When gdalwarp sees you have
"-of VRT" it does alot of special stuff to write out a new VRT describing
the warp instead of actually performing the warp. But you should be able
to warp into a preexisting raw file described with a .vrt file.
> Is what I'm attempting supported?
I think so, with the -of caveat.
> On a more philosophical level, is it insane?
Umm, you should be aware that you are stressing things a bit beyond what
I had in mind. In particular, be aware that having .vrt files using
<SimpleSource>
to describe mosaics of many tiles may have performance problems. The
implementation of the <SimpleSource> mechanism does *not* scale gracefully
up to hundreds of thousands of files. Though it should work fine for dozens
of files.
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