<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ok&nbsp;never-mind, I&nbsp;found&nbsp;the problem was I was using a comma, to delimit the tre-name and contents, and Franks note indicated an '=' was needed.<div>The NITF documentation page needs to be updated to reflect this.</div><div>Thanks;</div><div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Times; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Kurt Landrus</div><div>Progeny Systems Corp.</div><div><a href="mailto:klandrus@progeny.net">klandrus@progeny.net</a></div><div>Office:<span class="Apple-converted-space">&nbsp;</span><span class="Apple-tab-span" style="white-space: pre; ">        </span>703-368-6107 x424</div><div><div>Lab:<span class="Apple-converted-space">&nbsp;</span><span class="Apple-tab-span" style="white-space: pre; ">        </span>703-368-6107 x520</div><br></div></div></span><br class="Apple-interchange-newline"> </div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>From: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Kurt Landrus &lt;<a href="mailto:klandrus@progeny.net">klandrus@progeny.net</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Date: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">November 17, 2008 1:19:20 PM EST</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>To: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Frank Warmerdam &lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>>, <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Subject: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><b>Re: [gdal-dev] NITF TRE support</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> </div><div>Ok thanks for your reply. I downloaded the beta, and updated my code to use the options in the create fcn.<br>I am now getting an error from the driver on the create call, for the options.<br>I am creating the option with the TRE &nbsp;in the same format as loaded &nbsp;using GDAL.<br><br>### saving TRE SENSRA = FSBS2 &nbsp;&nbsp;&nbsp;+35.000000-077.000000B+01200f &nbsp;&nbsp;&nbsp;&nbsp;+74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br>### treContents = TRE=SENSRA,FSBS2 &nbsp;&nbsp;&nbsp;+35.000000-077.000000B+01200f &nbsp;&nbsp;&nbsp;&nbsp;+74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br>ERROR 1: Could not parse creation options SENSRA,FSBS2 &nbsp;&nbsp;&nbsp;+35.000000-077.000000B+01200f &nbsp;&nbsp;&nbsp;&nbsp;+74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br><br>$ gdalinfo &nbsp;--version<br>GDAL 1.6.0beta2, released 2008/11/12<br><br>Here is the code snippet where this error occurred.<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (saveOk) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// save TRE segments to dataset.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*treValue = NULL, *treName = NULL, *treContents = NULL;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*tre = "TRE_SENSRA";<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**options = NULL;<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parasite = gimp_image_parasite_find (image_ID, tre);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (parasite != NULL) {<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;treValue = (char *) g_strndup(gimp_parasite_data (parasite),<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gimp_parasite_data_size (parasite));<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gimp_parasite_free (parasite);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;treName = g_strdup(tre+4);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFDBG printf( "### saving TRE %s = %s\n", treName, treValue);<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;treContents = g_strconcat(treName, ",", treValue, NULL);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;options = CSLSetNameValue( options, "TRE", treContents );<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFDBG printf( "### treContents = %s\n", *options);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataset = GDALCreate( driver, filename, width, height, channels,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GDT_Byte, options );<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( dataset == NULL ){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g_warning("NITFview error opening dataset\n");<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;saved = FALSE;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>Do you have any suggestions why it can't parse the options?<br><br>Thanks;<br><br>Kurt Landrus<br>Progeny Systems Corp.<br><a href="mailto:klandrus@progeny.net">klandrus@progeny.net</a><br>Office: <span class="Apple-tab-span" style="white-space:pre">        </span>703-368-6107 x424<br>Lab: <span class="Apple-tab-span" style="white-space:pre">        </span>703-368-6107 x520<br><br><br><br>On Nov 13, 2008, at 8:30 PM, Frank Warmerdam wrote:<br><br><blockquote type="cite">Kurt Landrus wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Ok, I was looking through nithfile.c, &nbsp;am I correct in understanding that the only TRE supported for saving is BLOCKA, and that each additional TRE needs to be handled<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">individually?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I need to add support for the following TREs. &nbsp;But I don't really need to add new SDE headers, but preserve the original values as read<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">using GDALGetMetadataItem.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">SENSRA<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">AIMIDB<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ACFTB<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Is there an easy way to save back an TRE that was read using GDAL (/0 escaped string)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">or should I pull out all the fields from the string, and then reassemble them in a function as is done for BLOCKA?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Kurt,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The GDAL trunk code (ie. 1.6 beta2) does include generic support for<br></blockquote><blockquote type="cite">writing *image* TREs. &nbsp;Each TRE needs to be in the creation options<br></blockquote><blockquote type="cite">list as an item with TRE=&lt;trename>=&lt;content of tre> and the content must be<br></blockquote><blockquote type="cite">escaped using the BackslashQuotable scheme.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This is exactly the same format the TREs are read into the TRE<br></blockquote><blockquote type="cite">metadata domain.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Currently there is no support for writing file TREs.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Best regards,<br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite">---------------------------------------+--------------------------------------<br></blockquote><blockquote type="cite">I set the clouds in motion - turn up &nbsp;&nbsp;| Frank Warmerdam, warmerdam@pobox.com<br></blockquote><blockquote type="cite">light and sound - activate the windows | http://pobox.com/~warmerdam<br></blockquote><blockquote type="cite">and watch the world go round - Rush &nbsp;&nbsp;&nbsp;| Geospatial Programmer for Rent<br></blockquote><blockquote type="cite"><br></blockquote><br></div></blockquote></div><br></div></body></html>