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.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to