[R-sig-Geo] rgdal installation
Michael Sumner
mdsumner at utas.edu.au
Mon Mar 17 10:37:27 CET 2008
Hello, to find which drivers are available to you in rgdal use
gdalDrivers(). These won't be as many as are available in FWTools,
unless you build rgdal from source against FWTools itself. For HDF you
must build rgdal against your own GDAL installation.
I've done this with VC++ - see the notes in rgdal/README.windows - it's
fairly painful, and I haven't done it for several rgdal releases.
Far easier is to build GDAL and rgdal from source with msys, and I have
detailed instructions provided by Roger Bivand that I could find.
But perhaps even simpler is to use gdal_translate - calls to this via
system can be conveniently wrapped into a simple function to handle the
georeferencing as well (which HDF rarely provides fully). It is simply
not possible to build a single rgdal to handle both HDF and netCDF, and
so I have resorted to this method for such formats, rather than maintain
2 separate rgdal builds.
I gather that your files are MODIS Terra SST, and so you still need to
wrap the calls for reading since the georeferencing will not be
available automatically, so I suggest that having access from rgdal will
only give you slight benefit anyway.
Finally, if the files are composed of subdatasets (SDS) you would need
to refer to that directly, rather than the file name.
This will tell you about the SDS:
gdalinfo T20060012006008.L3m_8D_NSST_9.hdf
This will give you access to the first SDS:
gdalinfo HDF4_SDS:UNKNOWN:"T20050172005024.L3m_8D_NSST_9.hdf":0
HTH
Cheers, Mike.
David PINAUD wrote:
> Dear all,
>
> I'm trying to import HDF (v4) files on R2.6.2 using the package rgdal
> and FWTools v2.1.0. I have the following message :
>
> > GDALinfo("T20060012006008.L3m_8D_SST_9.hdf")
> Erreur dans .local(.Object, ...) :
> GDAL Error 4: `T20060012006008.L3m_8D_SST_9.hdf' not recognised
> as a supported file format.
>
> I can load this file with FWTools without problem.
> I suppose that rgdal is not able to recognize the path to the
> FWTools/bin directory:
> > library(rgdal)
> Le chargement a nécessité le package : sp
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.5.0, released 2007/12/18
> GDAL_DATA: C:/PROGRA~1/R/R-26~1.2/library/rgdal/gdal ####### it
> should be FWTools/bin ?? #####
> Loaded PROJ.4 runtime: Rel. 4.6.0, 21 Dec 2007
> PROJ_LIB: C:/PROGRA~1/R/R-26~1.2/library/rgdal/proj
>
> However I set before the PATH environment variable in Windows
> (Start>Parameters>Configuration Panel>System>Advanced>Environment
> variables : GDAL_DATA set to C:\Program Files\FWTools2.1.0\bin) as
> explained in http://rgdal.sourceforge.net/. No effect.
>
> What's wrong ? Is there a thing that I've missed or didn't do
> correctly? Is there another way to set this directory?
>
> Thank you for your help^.
>
> David
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.21.7/1331 - Release Date: 2008-03-16 10:34
>
More information about the R-sig-Geo
mailing list