Add support for HDF5 data

Description

HDF5 data is used more and more. Mostly with meteorological data.

Currently MapWinGIS can't handle HDF5 data. When the HDF5 dlls are added to the ocx output path it can do a GDALInfo on a HDF5 file but that is all.

HDF5 files have subdatasets (http://www.gdal.org/frmt_hdf5.html). When adding such a file to QGis the user is prompted to select the subdatasets it wants to see. Next the selected subsets are loaded as separate layers.
I think we should add a similar workflow.

I have a start of a unit test for this as OpenHdf5() in D:\dev\MapwinGIS\unittests\MapWinGISTests\GdalTests.cs
It also has a test file.

utils.GDALInfo("HDF5/test.h5") works on the file and results in:

Grid.Open returns false, but nothing is reported in grd.ErrorMsg[grd.LastErrorCode] or settings.GdalLastErrorMsg
Here something with the subdatasets should be returned, I think.

Next step would be to open only to subset. Using utils.GDALInfo("HDF5:\"HDF5/test.h5\"://image1/image_data")
doesn't work.
Using gdalinfo HDF5:"HDF5/test.h5"://image1/image_data on the command line does work:

The first step would be to fix Utils.GdalInfo(). This might be solved when is implemented.

Next step would be to somehow return the subdatasets so the MapWinGIS developer or MW5 can act on that.
The final step would be to open the subset as grid or raster and add it to the map.

Activity

Show:
Paul Meems
January 9, 2017, 10:29 AM
Edited

I just tested my unit test again and this time it is successful.
Most likely because I made some changes for copying the HDF5 dlls and somehow I didn't test it properly the previous time.

With this piece of code I can add the subset to the map:

So the only tricky part left is to get the names of the subsets.
Perhaps by adding grd.GetSubsets() which returns a string list, which can be called when grd.Open() of the main .h5 file fails.

Assignee

Sergei Leschinsky

Reporter

Paul Meems

Labels

Epic Link

None

Affects versions

Fix versions

Priority

Medium
Configure