gdal编译集成hdf4库和hdf5库的方法

一、前言

HDF也是一种自描述格式文件,主要用于存储和分发科学数据。气象领域中卫星数据经常使用此格式,比如MODIS,OMI,LIS/OTD等卫星产品。有两种HDF格式,HDF4和HDF5,每种格式都有自己的库和驱动程序。HDF4更常见,但HDF5是下一代格式。[(https://trac.osgeo.org/gdal/wiki/HDF)]
gdal默认不支持HDF影像数据的读取,需要自行编译。

如何编译

  1. 下载HDF4、HDF5库(Download the HDF library from the official website (https://www.hdfgroup.org/downloads/hdf4/).)
  2. 根据您的操作系统,编译并安装HDF库。
  3. 修改gdal编译文件(namke.opt文件)
  4. 编译gdal c++版本
  5. 编译gdal c#版本

二、修改gdal编译文件

修改支持HDF4

修改nmake.opt文件439-448行如下 :

#Uncomment the following and update to enable NCSA HDF Release 4 support.
 HDF4_PLUGIN = NO HDF4_DIR =	F:\02-learn\gdal\3part64\hdf4\x64 HDF4_LIB
> =	$(HDF4_DIR)\lib\hdf.lib $(HDF4_DIR)\lib\mfhdf.lib Ws2_32.lib HDF4_INCLUDE = $(HDF4_DIR)\include
> # HDF4 library newer than 4.2.5 has a SDreset_maxopenfiles/SDget_maxopenfiles
> # interface which allows opening many HDF files simultaneously (the max
> # number of files was previously hardcoded and too low, smth. like 32).
> # Uncomment following if your library is newer than 4.2.5. HDF4_HAS_MAXOPENFILES = YES

修改支持HDF5

修改nmake.opt文件450-453行如下:

#Uncomment the following and update to enable NCSA HDF Release 5 support.
HDF5_PLUGIN = NO
HDF5_DIR =	F:\02-learn\gdal\3part64\hdf5\x64
HDF5_LIB =	$(HDF5_DIR)\lib\hdf5.lib 

三、编译GDAL

gdal编译参考文章c#版gdal。

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值