<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi <span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">Even,</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">Thank
you for your reply.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">Is there
a simpler example to remove DES (say DES ID = 1) from an existing NITF, or replace DES with a null string?</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Even Rouault <even.rouault@spatialys.com><br>
<b>Sent:</b> August 24, 2021 1:50 PM<br>
<b>To:</b> ni hao <ni_hao88@hotmail.com>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] NITF DES</font>
<div> </div>
</div>
<div>
<p>Hello,</p>
<p>yes, first look:</p>
<p>- at the doc of the DES creation option in <a class="x_moz-txt-link-freetext" href="https://gdal.org/drivers/raster/nitf.html#creation-issues">
https://gdal.org/drivers/raster/nitf.html#creation-issues</a></p>
<p>- at <a class="x_moz-txt-link-freetext" href="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</a></p>
<p>you will need to compose the DES segment in a relatively low level.</p>
<p>Look at examples in :</p>
<p>- <a class="x_moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3728">
https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3728</a></p>
<p>- <a class="x_moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3795">
https://github.com/OSGeo/gdal/blob/de6a6b44302be5c6a294d86f6ca35ebcdce563ff/autotest/gdrivers/nitf.py#L3795</a><br>
</p>
<p>Note: <span class="x_pl-s1">gdal</span>.<span class="x_pl-v"><span class="x_pl-token">EscapeString</span></span>(<span class="x_pl-s1">des_data</span>,
<span class="x_pl-s1">gdal</span>.<span class="x_pl-v">CPLES_BackslashQuotable</span>) with binary data only works since a commit done yesterday in GDAL master!</p>
<p>If using an older version, backslash escaping can be done with :</p>
<pre>escaped_data = data.replace(b'\\', b'\\\\').replace(b'\0', b'\\0') \
.replace(b'\"', b'\\"').replace(b'\n', b'\\n')</pre>
<p>Best regards,<br>
</p>
<p>Even<br>
</p>
<div class="x_moz-cite-prefix">Le 24/08/2021 à 18:45, ni hao a écrit :<br>
</div>
<blockquote type="cite">
<div>Hi List,</div>
<div><br>
</div>
<div>Is there a GDAL utility or Python code to delete/alter/write to NITF Data Extension Segments (DES) ?<span></span></div>
<div><br>
</div>
<div>Thanks.</div>
<br>
<fieldset class="x_mimeAttachmentHeader"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="x_moz-signature" cols="72">--
<a class="x_moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</body>
</html>