[geotk] Netcdf Coverage

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Thu Dec 9 04:18:56 EST 2010

Hello Fabien

Le 09/12/10 01:48, Fabien Carrion a écrit :
> I am trying to move my project from geotools to geotoolkit, but I have a
> problem. In geotools, the class NetcdfImageReader has a method to
> getStatistics min and max values of a variable, which doesn't exists in
> geotoolkit.
Actually the information is still there, but in a different way. A more standard 
way to get this kind of information with the Image I/O API is using IIOMetadata. 
In Geotk, we defined a SpatialMetadataFormat as a subset of ISO 19115-2. You can 
see the format here:


In the right column, there is minValue and maxValue attributes. You can access 
them as below:

    NetcdfImageReader reader = ...,
    SpatialMetadata metadata = reader.getImageMetadata(0);

    /// From that point, there is a choice. You can explore
    // the metadata using the standard API like a XML tree.
    // Or you can use the convenience methods below.
    List<SampleDimension> bands = metadata.getListForType(SampleDimension.class);
    SampleDimension firstBand = bands.get(0);
    Double minValue = firstBand.getMinValue(); /// WARNING: Can be null!/
    Double maxValue = firstBand.getMaxValue(); /// WARNING: Can be null!/

*Tip:* If you wish to explore visually the metadata of your NetCDF file, the 
following may be useful (the following widget is defined in the 
geotk-widgets-swing module).

    ImageFileChooser chooser = new ImageFileChooser("NetCDF", true);

Then select your NetCDF file, and click on the "Metadata" tabs on the right 
side. Select the metadata format in the combo box, and you should see the 
metadata tree just below.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20101209/2460ea68/attachment.html

More information about the Geotoolkit mailing list