[gdal-dev] Adding multiple TREs to a NITF using gdal_translate
Even Rouault
even.rouault at spatialys.com
Tue Jun 11 06:00:06 PDT 2024
Le 11/06/2024 à 12:11, Marek Setnik via gdal-dev a écrit :
>
> Hello!
>
> I'm having trouble with adding multiple TREs to a NITF file (using C++
> API), the documentation mentions that the TRE creation options allows
> for that but I can't figure out the syntax, how do I achieve something
> like this: TRE=NAME1=VALUES1,NAME2=VALUES2 ? (I also tried to use TRE
> creation option twice like so: -co TRE=NAME1=VALUES1 -co
> TRE=NAME2=VALUES2, but the second TRE gets ignored)
>
You need to specify the TRE=NAME=VALUE several times
$ gdal_translate byte.tif test.ntf -co TRE=NAME1=VALUES1 -co
TRE=NAME2=VALUES2
$ gdalinfo test.ntf
[...]
Metadata (TRE):
NAME1=VALUES1
NAME2=VALUES2
Using the C++ API, this would be something like:
char** options = NULL;
options = CSLAddString(options, "TRE=NAME1=VALUES1"); // Do not use
CSLSetNameValue() otherwise the second TRE would override the first one
options = CSLAddString(options, "TRE=NAME2=VALUES2");
GDALCreateCopy(hDrv, "out.ntf", src_ds, false, options, nullptr, nullptr);
Even
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240611/0465dd31/attachment.htm>
More information about the gdal-dev
mailing list