<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ok never-mind, I found 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"> </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>703-368-6107 x424</div><div><div>Lab:<span class="Apple-converted-space"> </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 <<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 <<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 in the same format as loaded using GDAL.<br><br>### saving TRE SENSRA = FSBS2 +35.000000-077.000000B+01200f +74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br>### treContents = TRE=SENSRA,FSBS2 +35.000000-077.000000B+01200f +74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br>ERROR 1: Could not parse creation options SENSRA,FSBS2 +35.000000-077.000000B+01200f +74.998+000.000+014.996+70.000+009.998010.0N0020.0f075.0+1020m<br><br>$ gdalinfo --version<br>GDAL 1.6.0beta2, released 2008/11/12<br><br>Here is the code snippet where this error occurred.<br><br> if (saveOk) {<br> // save TRE segments to dataset.<br> char *treValue = NULL, *treName = NULL, *treContents = NULL;<br> char *tre = "TRE_SENSRA";<br> char **options = NULL;<br><br> parasite = gimp_image_parasite_find (image_ID, tre);<br> if (parasite != NULL) {<br><br> treValue = (char *) g_strndup(gimp_parasite_data (parasite),<br> gimp_parasite_data_size (parasite));<br> gimp_parasite_free (parasite);<br> treName = g_strdup(tre+4);<br> IFDBG printf( "### saving TRE %s = %s\n", treName, treValue);<br><br> treContents = g_strconcat(treName, ",", treValue, NULL);<br> options = CSLSetNameValue( options, "TRE", treContents );<br> IFDBG printf( "### treContents = %s\n", *options);<br> }<br><br> dataset = GDALCreate( driver, filename, width, height, channels,<br> GDT_Byte, options );<br> if( dataset == NULL ){<br> g_warning("NITFview error opening dataset\n");<br> saved = FALSE;<br> }<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, 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. 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. Each TRE needs to be in the creation options<br></blockquote><blockquote type="cite">list as an item with TRE=<trename>=<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 | 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 | Geospatial Programmer for Rent<br></blockquote><blockquote type="cite"><br></blockquote><br></div></blockquote></div><br></div></body></html>