[gdal-dev] GDAL setMetadata(HashTable) / setMetadata(String) on java.

Tamas Szekeres szekerest at gmail.com
Fri Jan 18 05:47:30 EST 2008


2008/1/18, Daniele Romagnoli <dany.geotools at gmail.com>:
> Hi list,
> I have some problems to set metadata in a dataset (as an instance, a
> GeoTiff) using Java bindings.
> I'm attempting to add some metadata in the default domain (""). I also have
> enabled the PAM mechanism which should allow to add auxiliary metadata.
>
> Now, when I attempt to set several metadata using the following code,
> dataset.setMetadata("IMAGE__INPUT_NAME=temp","");
> dataset.setMetadata("IMAGE__WIDTH=3000","");
>  dataset.setMetadata("IMAGE__HEIGHT=3000","");
>
> only the last one (IMAGE__HEIGHT=3000) is displayed when calling gdalinfo on
> the just created output dataset.
> Is the setMetadata method "overriding"? I mean: does any setMetadata call
> override the last set value?

This is the expected behaviour right now. This member creates a
metadata list on the fly that has only one item that have been given
as the function parameter.
You should file a ticket and apply for SetMetadataItem/SetMetadataItem
whatever to be exposed to the SWIG interface.

> Finally, I also have attempted to directly use an HashTable as input
> parameter of setMetadata and the JVM crashes.
> (I also have tuned the HashTable to be sure it does not contains null
> keys/entries).
>

That might be a java bindings related issue, how the HashTable is
mapped from the target language to C/C++. That's worthy for a ticket
as well, however I'm not sure whether we currently have an active java
bindings maintainer or not.

Best regards,

Tamas


More information about the gdal-dev mailing list