[gdal-dev] NITF DES

ni hao ni_hao88 at hotmail.com
Tue Aug 24 11:07:37 PDT 2021


Hi Even,

Thank you for your reply.
Is there a simpler example to remove DES (say DES ID = 1) from an existing NITF, or replace DES with a null string?



________________________________
From: Even Rouault <even.rouault at spatialys.com>
Sent: August 24, 2021 1:50 PM
To: ni hao <ni_hao88 at hotmail.com>; gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] NITF DES


Hello,

yes, first look:

- at the doc of the DES creation option in https://gdal.org/drivers/raster/nitf.html#creation-issues

- at https://gdal.org/drivers/raster/nitf_advanced.html#data-extension-segments-xml-des

you will need to compose the DES segment in a relatively low level.

Look at examples in :

- https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3728

- https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3795

Note: gdal.EscapeString(des_data, gdal.CPLES_BackslashQuotable) with binary data only works since a commit done yesterday in GDAL master!

If using an older version, backslash escaping can be done with :

escaped_data = data.replace(b'\\', b'\\\\').replace(b'\0', b'\\0') \
                   .replace(b'\"', b'\\"').replace(b'\n', b'\\n')

Best regards,

Even

Le 24/08/2021 à 18:45, ni hao a écrit :
Hi List,

Is there a GDAL utility or Python code to delete/alter/write to NITF Data Extension Segments (DES) ?

Thanks.



_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
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/20210824/bae4cd2f/attachment-0001.html>


More information about the gdal-dev mailing list