[gdal-dev] Copy or translate ?

Pierre Chatelier pierre at chachatelier.fr
Wed Mar 31 06:14:39 PDT 2021


Hello,
This a question about good practice in GDAL.

A data source provides me fixed-sized blocks of data, but the total 
amount of data is not known in advance.
To store them until the "end" event, I incrementally add those blocks to 
a dataset using AddBand() (supported by driver "MEM")

But once the dataset is complete, I want to reorder its data (because 
what I used as X will be in fact a band, Y will become X, and band will 
become Y) (and I want to store that in a ENVI BIL file for the 
efficiency of an exisiting tool later in the workflow)

I have different options  :
1)for each band : RasterIO(read from MEM dataset) -> tmp buffer -> 
RasterIO(write to ENVI dataset)
2)try to use gdal_translate_lib, but I will have a hard time figuring 
how to build the good parameters
3)something else ?

Considering performance first, what would you recommand ?

Pierre Chatelier





More information about the gdal-dev mailing list