Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need GDAL with both Shapefile and HDF4-Support, if possible in 64 bit. Since the normal GDAL-versions from have Shapefile, but no HDF4 and the version from FWTools has HDF4, but no Shapefiles (EDIT: see below), Im afraid I have to compile a GDAL-version by myself. The problem is that Im 'just' a geographer with programming skills, but no real IT-expert, and Ive never compiled open source by myself, so maybe my question is quite simple for you. :)

First Ive downloaded the source code from 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 cant 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 isnt that important)

EDIT PS.: I found out that FW-Tools-GDAL has Shapefile-support, its just my C#-project that cant use the vector-part of this old GDAL-version. In newer GDAL-versions Im able to use vector- and rasterfiles with the same code, but unfortunately they dont 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 ?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.