[gdal-dev] NITF DES
Even Rouault
even.rouault at spatialys.com
Tue Aug 24 11:28:24 PDT 2021
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.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
> <https://gdal.org/drivers/raster/nitf.html#creation-issues>
>
> - at
> https://gdal.org/drivers/raster/nitf_advanced.html#data-extension-segments-xml-des
> <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#L3728>
>
> -
> https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3795
> <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 <https://lists.osgeo.org/mailman/listinfo/gdal-dev>
> --
> http://www.spatialys.com <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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210824/fe831aaa/attachment.html>
More information about the gdal-dev
mailing list