Thank you Even for your help.

________________________________
From: Even Rouault <even.roua...@spatialys.com>
Sent: August 24, 2021 3:28 PM
To: ni hao <ni_ha...@hotmail.com>; gdal-dev@lists.osgeo.org 
<gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] NITF DES



Le 24/08/2021 à 20:07, ni hao a écrit :
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?
No, there's no code to update/remove a DES . You'll need to edit the file at 
byte level, or rewrite a new one without them



________________________________
From: Even Rouault 
<even.roua...@spatialys.com><mailto:even.roua...@spatialys.com>
Sent: August 24, 2021 1:50 PM
To: ni hao <ni_ha...@hotmail.com><mailto:ni_ha...@hotmail.com>; 
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org> 
<gdal-dev@lists.osgeo.org><mailto:gdal-dev@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@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.

--
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