MODIStsp
requires R v >= 3.2.1 and GDAL (Geospatial Data Abstraction Library) v >= 1.11.1 with support for HDF4 raster format to be installed in your system. Brief instructions for installing R and GDAL can be found HERE.
You can install the stable version of MODIStsp
, from CRAN:
install.packages("MODIStsp")
, or the development version (containing the latest improvements and bug fixes):
library(devtools)
install_github("lbusett/MODIStsp")
Note that if the GTK+
library is not already installed on your system, installation may fail. In that case, please install and load the gWidgetsRGtk2
library beforehand:
install.packages("gWidgetsRGtk2")
library(gWidgetsRGtk2)
Upon loading gWidgetsRGtk2
, an error window will probably appear. This signals that library “GTK+” is not yet installed on your system or is not on your PATH. To install itpress “OK”. A new window dialog window will appear, asking if you want to install “GTK+”. Select “Install GTK” and then “OK” . Windows will download and install the GTK+ library. When it finishes, the RSession should be restarted and you should be ready to go !
In case RStudio doesn’t automatically restart or continuously asks to install GTK+ again, kill it form “Task Manager” (or restart the R session from RStudio “Session” menu), reload RStudio and the try to reload gWidgetsRGtk2
. If it loads correctly, you should be ready to go.
If it still fails, try downloading the GTK+ bundle from:
http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip (OR http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip if on Win32)
, unzip the archive on a folder of your choice (e.g., C:\\Program Files\\GTK+
), then add the path to its “bin” subfolder (e.g., C:\\Program Files\\GTK+\\bin\\
to your system PATH environment variable.
Restart your system and try loading again gWidgetsRGtk2
: if it loads ok, you should be ready to install MODIStsp
To install MODIStsp
on Linux, you have to first install the following required dependencies:
Cairo
>= 1.0.0, ATK
>= 1.10.0, Pango
>= 1.10.0, GTK+
>= 2.8.0, GLib
>= 2.8.0 (required by package RGtk2
)Curl
(required by package curl
)GDAL
>= 1.6.3, PROJ.4
>= 4.4.9 (required by package rgdal
)On Debian and Ubuntu-based systems, to install those packages open a terminal and type:
sudo apt-get install r-cran-cairodevice r-cran-rgtk2 libcairo2-dev libatk1.0-dev libpango1.0-dev
libgtk2.0-dev libglib2.0-dev libcurl4-openssl-dev libgdal-dev libproj-dev
On rpm-base systems, to install packages open a terminal and type:
sudo yum install libcairo2-devel libatk1.0-devel libpango1.0-devel gtk2 gtk2-devel
glib2-devel libcurl-devel gdal-devel proj proj-devel proj-epsg proj-nad
Then, you can install the stable version of MODIStsp from CRAN:
install.packages("MODIStsp")
, or the development version (containing the latest improvements and bug fixes) from github;
library(devtools)
install_github("lbusett/MODIStsp")
NOTE: The following installation notes were kindly provided by a MODIStsp user and should be valid for MODIStsp installation on R 3.4.0 and above with Mac OSX Sierra. Since we are not working on Mac we were not able yet to check this, but we hope it may be useful at least to put you in the right direction if you have installation problems)
Installing MODIStsp requires many dependencies:
For installation on MAC OSX sierra, there are three main issues: - As outlined here in the comment by tobybot11 (https://gist.github.com/sebkopf/9405675), Rgtk requires the x11 libraries/headers (gdk/gdkx.h specifically) and doesn’t work with the quartz libraries/headers which now are the default for GTK - When installing the dependencies gWidgetsRGtk2 and cairoDevice from CRAN you need to choose the version “OS X Mavericks binaries” and not “Package source” - You have to be sure that gdal is installed with HDF4 support.
1 - Update to R > 3.4 if needed, then update all packages
# update packages
update.packages()
# install the development version of devtools:
install.packages(c("devtools"))
devtools::install_github("hadley/devtools")
2 - Now, install RGtk2 using Homebrew (https://gist.github.com/sebkopf/9405675). First, ensure you have cairo installed with “–with-x11”:
brew uninstall cairo --ignore-dependencies
brew install --with-x11 cairo
next, edit the configure options for GTK to require x11 rather than Quartz:
brew edit gtk+
in the def install section, remove the reference to quartz and switch to:
--with-gdktarget=x11,
--enable-x11-backend
Now install:
brew install --build-from-source --verbose gtk+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/pkgconfig/gtk+-2.0.pc:/opt/X11/lib/pkgconfig
3 - next, install RGtk2
. Since install.packages(“Rgtk2”) is not going to work, go here, download RGtk2_2.20.33.tar.gz and, from a terminal run:
R CMD INSTALL RGtk2_2.20.33.tar.gz
Now, open R and run:
library(RGtk2)
hopefully, RGTk2
will load without errors !
4 - Install packages gWidgetsRGtk2
and cairoDevice
Very important !!!! from CRAN, download the “OS X Mavericks binaries” for gWidgetsRGtk2 and cairoDevice( not “Package source”). Save both to Frameworks/R.framework/3.4…, open R and run the code below (This will also install cairoDevice)
install.packages("gWidgetsRGtk2",
lib="~/Library/Frameworks/R.framework/Versions/3.4/Resources/library/gWidgetsRGtk2")
library(gWidgetsRGtk2)
library(cairoDevice)
(This will work for R version 3.4, mac OS X Sierra)
5 - Install GDAL with HDF4 support
Check that gdal is installed with hdf4 support. From a terminal:
> gdal-config --formats
if gdal is installed, check what drivers are installed: the list should include hdf4.
If gdal is not yet installed or hdf4 is not supproted, install/reinstall it following these notes
> 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 now include hdf4:
> gdal-config --formats
6 - Install rgdal
since rgdal is not usually looking in “/usr/local/lib”" you must include that with install.packages()
:
install.packages('rgdal',
type = "source",configure.args = c(
'--with-proj-include=/usr/local/include',
'--with-proj-lib=/usr/local/lib')
)
7 - Finally, install MODIStsp from CRAN or GitHub:
install.packages("MODIStsp")
MODIStsp()
OR
library(devtools)
install_github("lbusett/MODIStsp", ref = "master")
MODIStsp()
Good luck! ________________________________________________________________________________
Download and install the latest version of R which can be found here.
Please refer to the documentation which can be found here, opening the directory relative to your Linux distribution. The documentation provides instruction to add CRAN repositories and to install the latest R version. With Ubuntu 15.10 Wily (and newer) this step is not mandatory (although recommended), since packaged version of R is >= 3.2.1 (although not the latest); in this case, user can install R by simply typing in a terminal
sudo apt-get install r-base
The easiest way to install GDAL on Windows is from the OSGeo4W Website
Ensure that your repositories contain a version of gdal-bin
>= 1.11.1. In particular, official repositories of Ubuntu 15.04 Vivid (or older) and Debian Jessie (or older) provide older versions of GDAL, so it is necessary to add UbuntuGIS-unstable repository before installing. To do this, follow instructions here). With Ubuntu 15.10 Wily (and newer) this step is not mandatory, although recommended in order to have updated version of GDAL installed.
To install GDAL, open a terminal and type
sudo apt-get install gdal-bin
GDAL is maintained updated to the latest version as binary package within the community repository; although that, the support for HDF4 format is not included. To bypass this problem, ArchLinux users can install gdal-hdf4
package from AUR (see here or here for the package installation from AUR). This package is updated manually after each release of gdal
on the community repository, so a temporal shift between a new gdal
release and the update of gdal-hdf4
could happen. If you want to manually add the support for HDF4 in case gdal-hdf4
is out-of-date, you can do it following these instructions.
Install the packaged binary of GDAL included in your specific distribution; if the version is older than 1.11.1, or if the support for HDF4 format is not included, you can manually install the HDF4 library and compile the source code by adding the parameter --with-hdf4
to the configure
instruction).