<html>
<head>
<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>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Looking through the code, I noticed the SWIG interface language. Going from that, I began looking into SWIG and what it can do. In the documentation, it talks about<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)">
Byte string output conversion (in section <span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; transform: scaleX(1.08575)">
32.12.4</span>). My understanding from that section of the SWIG documentation (<a href="http://swig.org/Doc4.0/SWIGDocumentation.pdf" style="" id="LPlnk474186">http://swig.org/Doc4.0/SWIGDocumentation.pdf</a>) is that SWIG assumes UTF-8 for every char when
sending it to python. <br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)">Do you have any experience working with the SWIG interface language? Is your understanding similar?</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)">Thanks!</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="left: 65.7643px; top: 990.204px; font-size: 12.2502px; font-family: sans-serif; transform: scaleX(1.08575)">Adam</span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Brad Hards <bradh@frogmouth.net><br>
<b>Sent:</b> Wednesday, November 6, 2019 11:02 PM<br>
<b>To:</b> Edson, Adam Robert <are131@psu.edu>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Cc:</b> Bradley, Eliza S <esb165@psu.edu><br>
<b>Subject:</b> RE: [gdal-dev] python GDAL issue</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
@font-face
{font-family:Consolas}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
pre
{margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New"}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
span.x_HTMLPreformattedChar
{font-family:Consolas}
p.x_xmsonormal, li.x_xmsonormal, div.x_xmsonormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xmsolistparagraph, li.x_xmsolistparagraph, div.x_xmsolistparagraph
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xmsonormal0, li.x_xmsonormal0, div.x_xmsonormal0
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xxmsonormal, li.x_xxmsonormal, div.x_xxmsonormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xxxmsonormal, li.x_xxxmsonormal, div.x_xxxmsonormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xxxxmsonormal, li.x_xxxxmsonormal, div.x_xxxxmsonormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
p.x_xmsochpdefault, li.x_xmsochpdefault, div.x_xmsochpdefault
{margin-right:0cm;
margin-left:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif}
span.x_xmsohyperlink
{color:blue;
text-decoration:underline}
span.x_xmsohyperlinkfollowed
{color:purple;
text-decoration:underline}
span.x_xhtmlpreformattedchar
{font-family:Consolas}
span.x_xemailstyle25
{font-family:"Calibri",sans-serif;
color:windowtext}
span.x_EmailStyle33
{font-family:"Calibri",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
{}
ol
{margin-bottom:0cm}
ul
{margin-bottom:0cm}
-->
</style>
<div lang="EN-AU" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="">I think it should check the “type” value. My “maybe this could work” concept was something like:</span></p>
<p class="x_MsoNormal"><span style=""> </span></p>
<p class="x_MsoNormal"><span style="">--- a/gdal/frmts/nitf/nitffile.c</span></p>
<p class="x_MsoNormal"><span style="">+++ b/gdal/frmts/nitf/nitffile.c</span></p>
<p class="x_MsoNormal"><span style="">@@ -2150,6 +2150,8 @@ static char** NITFGenericMetadataReadTREInternal(char **papszMD,</span></p>
<p class="x_MsoNormal"><span style=""> const char* pszName = CPLGetXMLValue(psIter, "name", NULL);</span></p>
<p class="x_MsoNormal"><span style=""> const char* pszLongName = CPLGetXMLValue(psIter, "longname", NULL);</span></p>
<p class="x_MsoNormal"><span style=""> const char* pszLength = CPLGetXMLValue(psIter, "length", NULL);</span></p>
<p class="x_MsoNormal"><span style="">+ const char* pszType = CPLGetXMLValue(psIter, "type", "string");</span></p>
<p class="x_MsoNormal"><span style="">+</span></p>
<p class="x_MsoNormal"><span style=""> int nLength = -1;</span></p>
<p class="x_MsoNormal"><span style=""> if (pszLength != NULL)</span></p>
<p class="x_MsoNormal"><span style=""> nLength = atoi(pszLength);</span></p>
<p class="x_MsoNormal"><span style="">@@ -2219,7 +2221,17 @@ static char** NITFGenericMetadataReadTREInternal(char **papszMD,</span></p>
<p class="x_MsoNormal"><span style=""></span></p>
<p class="x_MsoNormal"><span style=""> if (psOutXMLNode != NULL)</span></p>
<p class="x_MsoNormal"><span style=""> {</span></p>
<p class="x_MsoNormal"><span style="">- const char* pszVal = strchr(papszMD[(*pnMDSize) - 1], '=') + 1;</span></p>
<p class="x_MsoNormal"><span style="">+ </span></p>
<p class="x_MsoNormal"><span style="">+ char* pszVal = strchr(papszMD[(*pnMDSize) - 1], '=') + 1;</span></p>
<p class="x_MsoNormal"><span style="">+ if (strcmp(pszType, "IEEE754") == 0)
</span></p>
<p class="x_MsoNormal"><span style="">+ {</span></p>
<p class="x_MsoNormal"><span style="">+ // TODO: fix</span></p>
<p class="x_MsoNormal"><span style="">+ printf("IEEE754: 0x%02x 0x%02x 0x%02x 0x%02x\n", pszVal[0], pszVal[1], pszVal[2], pszVal[3]);</span></p>
<p class="x_MsoNormal"><span style="">+ pszVal = "FIXME1";</span></p>
<p class="x_MsoNormal"><span style="">+ } else if (strcmp(pszType, "UINT") == 0) {</span></p>
<p class="x_MsoNormal"><span style="">+ printf("UINT: 0x%02x 0x%02x 0x%02x 0x%02x\n", pszVal[0], pszVal[1], pszVal[2], pszVal[3]);</span></p>
<p class="x_MsoNormal"><span style="">+ pszVal = "FIXME2";</span></p>
<p class="x_MsoNormal"><span style="">+ }</span></p>
<p class="x_MsoNormal"><span style=""> CPLXMLNode* psFieldNode;</span></p>
<p class="x_MsoNormal"><span style=""> CPLXMLNode* psNameNode;</span></p>
<p class="x_MsoNormal"><span style=""> CPLXMLNode* psValueNode;</span></p>
<p class="x_MsoNormal"><span style=""> </span></p>
<p class="x_MsoNormal"><span style="">(I think the pzVal might need to be changed to a union / class that has char*, a double or an unsigned int; I haven’t dug further than this yet).</span></p>
<p class="x_MsoNormal"><span style=""> </span></p>
<p class="x_MsoNormal"><span style="">Brad</span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Edson, Adam Robert <are131@psu.edu>
<br>
<b>Sent:</b> Thursday, 7 November 2019 6:34 AM<br>
<b>To:</b> Brad Hards <bradh@frogmouth.net>; gdal-dev@lists.osgeo.org<br>
<b>Cc:</b> Bradley, Eliza S <esb165@psu.edu><br>
<b>Subject:</b> Re: [gdal-dev] python GDAL issue</span></p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Looking at the code, it appears that GDAL actually hard codes any TRE that takes anything that cannot be parsed as a string (e.g. nitfimage.c NITFReadICHIPB). So, for BANDSB with its EXISTENCE_MASK
and SCALE_FACTOR would need to be hard coded as opposed to being defined just within the nitf_spec.xml. Is this the correct interpretation?</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Thanks!</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Adam</span></p>
</div>
<div>
<div>
<p class="x_xxxxmsonormal"> </p>
</div>
</div>
</div>
</div>
</body>
</html>