[gdal-dev] HDF5 metadata format problems

Alex Mantaut alexmantaut at suremptec.com.ar
Tue Jun 14 10:38:45 EDT 2011


Frank:
        Thanks for your reply. I thought that there could be a trim funcion
on CPL... I will use that code to trim my string...

Another question: To get several fields from the file's metadata, is it
better to use GetMetadata() and then search within the array for the fields,
or use GetMetadataItem() several times in order to get the necesary fields?
GetMedata() can take more memory than necesary, but I'm not sure if
GetMetadataItem() performs a read on the file, which could be slow...

Regards
Alex

2011/6/14 Frank Warmerdam <warmerdam at pobox.com>

> On 11-06-14 10:08 AM, Alex Mantaut wrote:
>
>> Hi Frank:
>>             Thanks for your response. I wasn't sure if the whitespace was
>> allways going to be there, because for some fields had the white space but
>> others didn't. I will remove the trailing whitespace.
>> Now, I'm trying to develop a modification on the HDF5 driver to allow it
>> to get
>> the georreference information from COSMO-SKYMED HDF5 files... The thing is
>> I'm
>> not really familiar with the libraries used by GDAL(the use of iostream is
>> not
>> allowed right?), what would be the better way to trim a string? I looked
>> into
>> cpl_string and didn't found a simple way to do it (I could use
>> CSLTokenizeString() and get the first field on the list, but this seems
>> overly
>> convoluted for a simple trim)
>> Also, is there any guidelines on which libraries to use on C++ in replace
>> of
>> their std equivalents?
>>
>
> Alex,
>
> I would likely do something like:
>
>  CPLString osMD = poDS->GetMetadataItem('...');
>
>  while( osMD.size() > 0 && osMD[osMD.size()-1] == " " )
>    osMD.resize(osMD.size()-1));
>
> You can use STL and sstream though we don't normally do file io through
> iostreams since we go through the VSI*L "posix-like" API which allows
> io virtualization.
>
> Note that CPLString is just an improved (or as some would say polluted)
> std::string.
>
>
> Best regards,
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
--
     Alex Mantaut
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
javierurien at suremptec.com.ar
www.suremptec.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110614/cc2dd1e6/attachment-0001.html


More information about the gdal-dev mailing list