Opened 9 years ago
Closed 6 years ago
#5802 closed defect (fixed)
gdal HDF5 NetCDF plugin bug
Reported by: | liminlu0314 | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.2 |
Component: | GDAL_Raster | Version: | 1.11.1 |
Severity: | normal | Keywords: | gdal HDF5 NetCDF plugin |
Cc: | antonio |
Description
I found a problem with the HDF5 plugin in GDAL library: it can open H5 file, but cannot open the sub data set. The reason is that, when GDAL register HDF5 plug-in, it only call a registered function (GDALRegister_HDF5), while it needs another function GDALRegister_HDF5Image () to open HDF5 sub datasets. The problem also exists in HDF4 and NetCDF plugin.
Modify the file gdaldirvermanager.cpp in void GDALDriverManager::AutoLoadDrivers()
if( pRegister != NULL ) { CPLDebug( "GDAL", "Auto register %s using %s.", pszFilename, pszFuncName ); ((void (*)()) pRegister)(); // 如果一个插件dll中有多个注册函数,目前针对特殊的几种格式进行特殊处理 const char* pszBaseName = CPLGetBasename(papszFiles[iFile]) + 5; if( EQUAL(pszBaseName, "HDF4") || EQUAL(pszBaseName, "HDF5") ) { CPLString osLastErrorMsg(CPLGetLastErrorMsg()); sprintf( pszFuncName, "GDALRegister_%sImage", CPLGetBasename(papszFiles[iFile]) + 5 ); pRegister = CPLGetSymbol( pszFilename, pszFuncName ); if( pRegister == NULL ) { CPLError( CE_Failure, CPLE_AppDefined, "%s", osLastErrorMsg.c_str() ); } CPLDebug( "GDAL", "Auto register %s using %s.", pszFilename, pszFuncName ); ((void (*)()) pRegister)(); } else if(EQUAL(pszBaseName, "NETCDF")) { CPLString osLastErrorMsg(CPLGetLastErrorMsg()); strcpy( pszFuncName, "GDALRegister_GMT" ); pRegister = CPLGetSymbol( pszFilename, pszFuncName ); if( pRegister == NULL ) { CPLError( CE_Failure, CPLE_AppDefined, "%s", osLastErrorMsg.c_str() ); } CPLDebug( "GDAL", "Auto register %s using %s.", pszFilename, pszFuncName ); ((void (*)()) pRegister)(); } }
Change History (5)
comment:1 by , 9 years ago
Cc: | added |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Backported in branches/1.11 in r28365
comment:4 by , 6 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
#ifdef HDF5_PLUGIN GDALRegister_HDF5Image(); #endif
... in GDALRegister_HDF5() needs to be ...
#ifdef HDF5_PLUGIN GDALRegister_HDF5Image(); GDALRegister_BAG(); #endif
... to get the BAG driver registered.
Note:
See TracTickets
for help on using tickets.
trunk r28355 "Windows build: when building netCDF, HDF4, HDF5 as plugins, call registration of 'sub-drivers' GMT, HDF4Image and HDF5Image (#5802)"