I need GDAL with both shapefile and HDF4-Support, if possible in 64 bit. Since the normal GDAL-versions from Link have shapefile, but no HDF4 and the version from FWTools has HDF4, but no Shapefiles (EDIT: see below), I'm afraid I have to compile a GDAL-version by myself.

The problem is that I'm 'just' a geographer with programming skills, but no real IT-expert, and I've never compiled open source by myself.

First I've downloaded the source code from http://trac.osgeo.org/gdal/wiki/DownloadSource. The I opened makegdal90.vcproj with Visual Studio 2010. It needed to do some updates, then it opened. If I compile it without changes, I get a GDAL-folder with a new GDAL19.dll. If I try to use this whole folder in my C#-project that works with normal GDAL-versions, I get a error. But if I only copy the new GDAL19.dll over the old one in the existing GDAL(32 bit)-folder it works.

Is this how it should be or is something going wrong here already ?

The second step is to switch to 64bit, in nmake.opt I changed the following entry: Uncomment the following if you are building for 64-bit windows (x64). You'll need to have PATH, INCLUDE and LIB set up for 64-bit compiles. WIN64=YES Then I changed the setting of the VS-project to X64 and compiled again. It still works as before: I get a new GDAL19.dll that works fine in my old GDAL(64 bit)-folder.

But then I can't do the third step, including HDF4. I found and changed the following section in nmake.opt: Uncomment the following and update to enable NCSA HDF Release 4 support. HDF4_PLUGIN = NO HDF4_DIR = C:\HDF HDF4_LIB = /LIBPATH:$(HDF4_DIR)\lib Ws2_32.lib I tried it maybe 100 times, but it never worked. Sometimes I get a corrupt GDAL19.dll, sometimes I get >100 errors when compiling and sometimes I get a working GDAL19.dll without HDF4-support. I've read almost every Google-hit in English and German I found, but it never worked. One problem is that the files mentioned there do not exist in the HDF-versions Ive downloaded. I guess, this tips were for much older versions of GDAL and HDF4.

So can anybody give a step by step tutorial "How to compile GDAL with HDF4 for dummies"?

I need to know which HDF4-files I need, where to get them, and what exactly I have to write in nmake.opt.

Or is there a ready to use GDAL-download with HDF4 and shapefiles somewhere ? (32 bit would be OK to, that isn't that important)

I found out that FW-Tools-GDAL has Shapefile-support, its just my C#-project that can't use the vector-part of this old GDAL-version. In newer GDAL-versions I'm able to use vector- and rasterfiles with the same code, but unfortunately they don't have HDF4..

Maybe I need an older version of the C#-GDAL-bindings?

Has anybody used FW-Tools-GDAL in a C#-project with shapefiles?

1 Answer 1


Another up to date project that includes HDF4 is the MS4W package available at https://www.ms4w.com

Not the answer you're looking for? Browse other questions tagged or ask your own question.