[gdal-dev] hdf5 dataset. Header data too long. Truncated

Rashad M mohammedrashadkm at gmail.com
Thu Sep 3 12:09:48 PDT 2015


increasing the limit of MAX_METADATA_LEN is acceptable?

On Tue, Sep 1, 2015 at 8:07 PM, Rashad M <mohammedrashadkm at gmail.com> wrote:

>
>
> On Tue, Sep 1, 2015 at 5:08 PM, Even Rouault <even.rouault at spatialys.com>
> wrote:
>
>> Le mardi 01 septembre 2015 16:50:32, Rashad M a écrit :
>> > Hello all,
>> >
>> > I have an the following warning from gdal when reading .h5 dataset
>> >
>> > Warning 2: Header data too long. Truncated.
>> >
>> > Looking at frmts/hdf5/hdf5dataset.cpp there is a define for
>> > MAX_METADATA_LEN
>> >
>> > #define MAX_METADATA_LEN 32768
>> >
>> >
>> > and there is a check
>> >                 if( CPLStrlcat(szValue, szData, MAX_METADATA_LEN) >=
>> >
>> > MAX_METADATA_LEN )
>> >                     CPLError( CE_Warning, CPLE_OutOfMemory,
>> >                               "Header data too long. Truncated\n");
>> >
>>
>> This was introduced in https://trac.osgeo.org/gdal/changeset/20438 to
>> avoid
>> crashes. Potentially it could be reworked to deal with arbitrary long
>> metadata. Although it could be kind of annoying to have too long values as
>> metadata item, especially in the main metadata domain. A cleaner solution
>> would perhaps be have something like "MY_ITEM=<value removed because too
>> large. query HDF5 metadata domain to get it>" and you'd have the full
>> value in
>> the HDF5 metadata domain (perhaps not unlimited but with a much higher
>> limit,
>> let's say 1 MB per item). People with more experience with HDF5 datasets
>> could
>> perhaps comment.
>>
>
> All of the truncated messages are coming when reading double. Here there
> is  %.15g. Isn't that too much ?  Could it be reduced or change to simply
> %g for double.?
>
> https://trac.osgeo.org/gdal/browser/branches/1.11/gdal/frmts/hdf5/hdf5dataset.cpp#L800
>
>
>>
>> > Now I could update MAX_METADATA_LEN but is there a way it can set be
>> set at
>> > runtime ?
>>
>> No, you need to recompile.
>>
>> --
>> Spatialys - Geospatial professional services
>> http://www.spatialys.com
>>
>
>
>
> --
> Regards,
>    Rashad
>



-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150903/6c743118/attachment.html>


More information about the gdal-dev mailing list