Installing MODIS for R
If you have installed MRT and OsGeow4, and reviewed the Modis data on datapool, then you are ready for the next step: Installing MODIS package. At the current writing the package is not posted to CRAN, that will happen in due course. If you want to get started, then, you’ll have to install it from source using bits available at R Forge.
Before I show you how to do that, let me pull up the description file from the package
Title: MODIS download and processing package. Processing
functionalities for (multi-temporal) MODIS grid data.
Depends: R (>= 2.10), raster, bitops
Suggests: RCurl, rgeos, XMLSchema, rgdal, mapdata, maptools, plotrix,
SSOAP, XML, snow, ptw
Author: Matteo Mattiuzzi, Jan Verbesselt, Forrest Stevens, Tomislav Hengl, Anja Klisch, Bradley Evans and Agustin Lobo
Maintainer: Matteo Mattiuzzi <email@example.com>
Description: MODIS download and processing Package. Downloading, re-projecting, re-sampling, mosaicking, format conversion, SDS-extraction, bit-enconding and filtering/smoothing capabilities. Download data from FTP (local processing) or using SSOAP (online processing) via the MODIS web-service. Pre-processing data with MRT, GDAL, FWT, SSOAP. Starting from version 0.3-14 also SRTMv41 can be downloadad. Manual: https://www.dropbox.com/sh/18t0rgcm6bga7xt/-4k_Xwojxr/MODIS
License: GPL (>=3)
Repository/R-Forge/DateTimeStamp: 2012-11-16 09:16:33
Date/Publication: 2012-11-16 09:16:33
Packaged: 2012-11-16 11:17:11 UTC; rforge
The package description lets us know what other packages we are going to have to install first to make the MODIS R package work. Using R Studio you need to go get the following packages: raster, bitops,RCurl,rgeos,XMLSchema, rgdal,mapdata,maptools,plotrix,SSOAP,XML,snow and ptw.
The only packages that might be a bit tricky to install are RCurl, and SSOAP. As I recall RCurl should work right out of the box on a windows system. It makes calls to curlib and your windows system should have that installed. SSOAP is a different matter.
In my current testing I havent been able to get any of the calls that rely on SSOAP to work, so I’ll be making bug reports. Still there are plenty of functions that dont need SSOAP. You just need it installed.
SSOAP resides here. This package is an “S” implementation of SOAP. To find out about SOAP.. wiki. I think of SOAP as just another way to get data from a web service. Instead of downloading from an ftp site, some services are set up to respond to SOAP requests or queries. Also, don’t be confused by the fact that SSOAP is a “S’ package. R is just an implementation of S.
When you download the package you will note that it is a source distribution, NOT a typical windows binary package which comes in a zip. That means we will have to build the package locally.
If you don’t know how to build a package on R then see my package tutorial. Specifically, we are going to be doing a windows build.
After you download the SSOAP package to a directory, you will want to “untar” or decompress the tar.gz file. If you don’t have winzip installed you can do this from within R using “untar” make sure to set the compressed variable to TRUE and it will default to unzipping a “gz” file.
With the file unzipped, you now use your windows console. Change directories until you are in the SSOAP directory and then use the command:
R CMD INSTALL –build SOAP_.09-0.tar.gz
This will create the package you need. Then using R Studio, install packages from a local zip. select SSOAP and you are good to go. If this is unclear, let me know and I will expand this section.
With all your packages installed you are ready to download the source code for MODIS. You will go through the same process as with SSOAP. get the source bits and use R CMD INSTALL. If you dont understand how to build packages, please read the tutorial.
The last step here will be getting MODIS bits. The source for the package is located Here
A few agreements however. Since the package has not hit CRAN yet, if you have any issues with the windows version you should probably contact me before you contact Matteo. He is pretty busy working on finalizing things and I don’t think we should interrupt him with too many questions. I’ll be going through the code and functions and doing windows testing as I write this tutorial, so if your are just learning R or struggling with this pre release code, it will probably help to work with me before we bug the developers. Of course you can ignore that and write to him directly.
Download the “tar.gz” file to a directory and then “unzip”. You should have all the source for the package. Next take the same steps as you did with SSOAP. Open a console window. > R CMD –build MODIS_0.6-22.tar.gz That should work to create a ‘zip’ binary. Then open R Studio and install packages from a local zip
Then go to the next step