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

Even Rouault even.rouault at spatialys.com
Tue Sep 1 08:08:39 PDT 2015


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.

> 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


More information about the gdal-dev mailing list