[gdal-dev] python GDAL issue
Brad Hards
bradh at frogmouth.net
Wed Nov 6 20:02:08 PST 2019
I think it should check the "type" value. My "maybe this could work" concept
was something like:
--- a/gdal/frmts/nitf/nitffile.c
+++ b/gdal/frmts/nitf/nitffile.c
@@ -2150,6 +2150,8 @@ static char** NITFGenericMetadataReadTREInternal(char
**papszMD,
const char* pszName = CPLGetXMLValue(psIter, "name", NULL);
const char* pszLongName = CPLGetXMLValue(psIter, "longname",
NULL);
const char* pszLength = CPLGetXMLValue(psIter, "length", NULL);
+ const char* pszType = CPLGetXMLValue(psIter, "type", "string");
+
int nLength = -1;
if (pszLength != NULL)
nLength = atoi(pszLength);
@@ -2219,7 +2221,17 @@ static char** NITFGenericMetadataReadTREInternal(char
**papszMD,
if (psOutXMLNode != NULL)
{
- const char* pszVal = strchr(papszMD[(*pnMDSize) - 1],
'=') + 1;
+
+ char* pszVal = strchr(papszMD[(*pnMDSize) - 1], '=') +
1;
+ if (strcmp(pszType, "IEEE754") == 0)
+ {
+ // TODO: fix
+ printf("IEEE754: 0x%02x 0x%02x 0x%02x 0x%02x\n",
pszVal[0], pszVal[1], pszVal[2], pszVal[3]);
+ pszVal = "FIXME1";
+ } else if (strcmp(pszType, "UINT") == 0) {
+ printf("UINT: 0x%02x 0x%02x 0x%02x 0x%02x\n",
pszVal[0], pszVal[1], pszVal[2], pszVal[3]);
+ pszVal = "FIXME2";
+ }
CPLXMLNode* psFieldNode;
CPLXMLNode* psNameNode;
CPLXMLNode* psValueNode;
(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).
Brad
From: Edson, Adam Robert <are131 at psu.edu>
Sent: Thursday, 7 November 2019 6:34 AM
To: Brad Hards <bradh at frogmouth.net>; gdal-dev at lists.osgeo.org
Cc: Bradley, Eliza S <esb165 at psu.edu>
Subject: Re: [gdal-dev] python GDAL issue
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?
Thanks!
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191107/20e6aa58/attachment.html>
More information about the gdal-dev
mailing list