Skip to content

OSX, rgdal, GDAL drivers and HDF4

5 messages · Ben Tupper, Gilles Benjamin Leduc, Shaun Walbridge

#
Hello,

This is my attempt to look before I leap into installing GDAL on OSX. (You can probably hear my pitiful groaning and knee-knocking in the background.)

I want to read many HDF4 files for which I do not have the GDAL HDF4 driver installed.  I used William Kyngesburye's nice framework (http://www.kyngchaos.com/software:frameworks) to install GDAL but it came without the HDF4 driver.

Reading this somewhat dated exchange... 

http://r-sig-geo.2731867.n2.nabble.com/Read-HDF-files-td6750856.html

... I think I understand that if I want the HDF4 driver I must build GDAL on my system manually.  Is my understanding correct, or is there another (easier) way to read HDF4 files directly in R?

Thanks!
Ben
Loading required package: sp
rgdal: version: 0.9-3, (SVN revision 530)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
 Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/gdal
 Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
 Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/proj
 Linking to sp version: 1.1-0
[1] FALSE
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgdal_0.9-3 sp_1.1-0   

loaded via a namespace (and not attached):
[1] grid_3.2.0      lattice_0.20-31



Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
#
Hi, 

I looked how I did. it seems I used a framwork named GDAL_Complete-1.11.dmg. I haven't used HDF4, so I don't know more 

Benjamin
On Tuesday, June 2, 2015 16:11 GMT, Ben Tupper <btupper at bigelow.org> wrote:

            
#
Have you tried with the homebrew project? HDF4 isn?t a default supported
driver, but it?s easy enough to add:

  brew install hdf4
  # prefer hdf4 links over NetCDF
  brew link --overwrite hdf4
  brew install gdal --complete --enable-unsupported --with-hdf4

  # check what drivers are installed, list should include ?hdf4?:
  gdal-config --formats

I?d use that as a starting point.

Cheers,
Shaun
On 6/2/15, 12:11 PM, "Ben Tupper" <btupper at bigelow.org> wrote:

            
#
Hi,
On Jun 2, 2015, at 1:56 PM, Shaun Walbridge <SWalbridge at esri.com> wrote:

            
Thanks!  I have not used brew before but it seems like it should be easy, or will be as soon as I figure out what this means...

ben at gale ~ $ brew install hdf4
Error: No available formula for hdf4 
Searching formulae...
Searching taps...
homebrew/versions/hdf4


Cheers,
Ben
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
#
I missed a step -- first you'll need to add Homebrew-versions [1], which
provides older releases of existing packages:

  brew tap homebrew/versions

The commands listed should then work.

1. https://github.com/Homebrew/homebrew-versions