[gdal-dev] Limits on use of VRTs?
Even Rouault
even.rouault at spatialys.com
Sun Sep 27 11:17:09 PDT 2015
Jose,
> I'm trying to do some python processing, and I thought that using VRTs
> would be a great way forward. My process is basically:
>
> 1.- Putting several bands together into a single dataset. A couple of bands
> have a different dataset (Byte vs Int16), so I'd like to upgrade these Byte
> bands to Int16
> 2.- Reprojecting the result of (1) to match a particular spatial extent and
> projection.
>
> The first step I was hoping to accomplish by simply doing gdalbuildvrt
> -separate (not in Python, just from the shell), but it appears that I need
> an extra gdal_translate to convert all the bands to Int16 (the first band
> is Byte, and gdalbuildvrt assumes all following bands will be Byte too).
You can edit the VRT and specify the desired data type. Just edit the dataType
attribute of the VRTRasterBand element and set it to Int16 for all bands. It
might be desirable to have a -ot switch for gdalbuildvrt in those situations.
Doing a "gdal_translate in.vrt out.vrt -ot Int16 -of vrt" can also workaround
that.
>
> Part 2 fails with a VRT dataset as input, but works OK with a GeoTIFF.
Yes, datasets with different data types for different bands might not properly
everywhere. Once converted into GeoTIFF, since that format only has a single
data type for all bands, that issue cannot happen.
Best regards,
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list