[gdal-dev] Implementing driver to support-of output format
Even Rouault
even.rouault at spatialys.com
Sun Mar 5 13:54:10 PST 2017
On dimanche 5 mars 2017 22:47:54 CET Mateusz Loskot wrote:
> Hi,
>
> I have a question about "-of output format" handling in a raster
> driver implementation:
>
> 1. src_byte.tif is single band of Byte data type.
>
> 2. gdal_translate -of GTiff -ot UInt16 src_byte.tif dst_uint16.tif
>
> 3. In an implementation of `CreateCopy`
>
> CreateCopy(char const* pszFilename, GDALDataset* poSrcDS, int bStrict, ...)
> {
> ...
> eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType();
> ...
> poSrcDS->RasterIO(GF_Read, ..., eDT, ...);
> ...
> }
>
> a) The source dataset band type is UInt16, while band in the source
> src_byte.tif file is Byte.
> b) RasterIO requests Uint16 from the src_byte.tif with Byte band.
>
> Which, if any, part is responsible for the magic that changes the
> pixel data form Byte to Uint16 during the RasterIO?
Hi Mateusz,
if you look at apps/gdal_translate_lib.cpp, you'll see that, except cases without any
arguments like gdal_translate in out -of output_format where the 'in' dataset is passed as the
source dataset of CretaeCopy(), as soon as you add some transformation like changing data
type, subsetting, etc, a in-memory VRT will be created to do that transformation. And it is
that in-memory VRT that is passed as the source dataset to the CreateCopy() implementation
of the output driver. That should answer all your following questions.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170305/2c9d7162/attachment.html>
More information about the gdal-dev
mailing list