<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 24/08/2021 à 20:07, ni hao a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR02MB38627C5ADA3BAF97707CEB0FF1C59@DM5PR02MB3862.namprd02.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <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>
    </blockquote>
    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<br>
    <blockquote type="cite"
cite="mid:DM5PR02MB38627C5ADA3BAF97707CEB0FF1C59@DM5PR02MB3862.namprd02.prod.outlook.com">
      <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 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 style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b> Even
          Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><br>
          <b>Sent:</b> August 24, 2021 1:50 PM<br>
          <b>To:</b> ni hao <a class="moz-txt-link-rfc2396E" href="mailto:ni_hao88@hotmail.com"><ni_hao88@hotmail.com></a>;
          <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org"><gdal-dev@lists.osgeo.org></a><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"
            moz-do-not-send="true">
            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"
            moz-do-not-send="true">
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"
            moz-do-not-send="true">
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"
            moz-do-not-send="true">
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" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" moz-do-not-send="true">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" moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>