1 Introduction

Having your system properly set-up is a cricial step before starting any geo-processing with R and Python. This short tutorial will guide you through some important steps that you should follw in order to have the required software installed and appropriately set-up. The figure below provides an overview of the different components of the system and how they are connected with each others.

Drawing

For the geo-scripting course (2017) we recommend you to work via a Linux environment as there all open-source tools, scripting languages (Python!) and their packages can be installed more easily. As such, in the PC labs we will work via SURFsara HPC Cloud, from which you are able to start up an Ubuntu Linux environment and connect to it remotely. It is also possible to connect to it from any other computer running the X2go software. See lesson 2 for more details.

In case you just want to use R, you can continue and still choose to work on Windows (see below). For Python programming we will work within a Linux environment.

2 On Windows

2.1 Linux on Windows

There are several other methods to have Linux running on a Windows machine. You can use virtualisation software, such as VirtualBox or VMWare Player, to install a Linux distribution into a virtual machine (VM). This method is convienient if you need to run both Windows and Linux programs at the same time, but the computer resources are then shared between the two operating systems.

Another method is to write a Linux distribution onto a USB stick, then reboot into it. That allows the Linux distribution to make use of all your computer resources. But changes made in a live environment are limited: only some files are saved, so packages that are installed disappear after a reboot. If you have an external hard drive, Linux can also be installed on it, allowing to save all changes.

The last method is to install Linux alongside Windows in a dual-boot combination. However, this change is permanent and should be done with caution.

In all cases, the OSGeo Live distribution is recommended for GIS work. For permanent installations, a more general-purpose distribution (Ubuntu, openSUSE, Mageia etc.) is recommended instead.

2.3 Specific R packages

Not all packages are hosted on the CRAN package repository, this is the case for instance of the MODIS package that is maintained on R Forge, and requires an extra argument in the install.packages() function to be installed. The install line, to be copy pasted in the R shell is often given on the package R forge home page.

3 Linux

See for more info also http://live.osgeo.org/en/index.html. Generally setup instructions are dependent on the Linux distribution, and almost always involves getting packages from the distribution’s package manager.

3.1 Debian/Ubuntu

3.1.1 R

R can be installed directly from the base repository.

sudo apt-get install r-base r-base-dev

For newer R versions and packages, see instructions here.

3.1.2 R GUIs

There are a variety of R GUIs available. Some of them, like RKWard, are packaged in the base repository:

sudo apt-get install rkward

RStudio is not currently packaged in the base repositories or any PPAs, but manual installation instructions can be found here.

3.1.3 GDAL/OGR/PROJ4/GEOS libraries

The easiest solution is probably to install these libraries directly from an apt repository. Recent versions of these libraries are maintained on the Ubuntu GIS ppa.

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update

Then install the libraries with apt-get.

sudo apt-get install gdal
sudo apt-get install proj
sudo apt-get install geos

Your system should be ready to install rgdal and rgeos R packages.

3.2 openSUSE

3.2.1 R

R can also be installed from the base repository:

sudo zypper install R-base R-base-devel

Newer versions are available from the devel:languages:R:released OBS repository.

3.2.2 R GUIs

Some R GUIs, such as RKWard, are available in the base repository:

sudo zypper install rkward

RStudio is packaged as part of the devel:languages:R:released repository, like R base.

3.2.3 GDAL/OGR/PROJ4/GEOS libraries

These libraries are provided by the Applications:Geo OBS repository.

4 Mac

Similarly as on windows we recommend to work via VMware Player. However, VMware Player is not free!!! It that is a problem, let us know that we recommend working via an USB3.0 stick and use a bootable OSGEOLIVE linux version (http://live.osgeo.org/)

4.1 Installing software directly on Mac

4.1.1 R and R Studio

Download and install the latest R version available from: [http://cran.r-project.org/bin/macosx/]. Download and install the latest Rstudio Desktop from the R Studio download page.

4.1.2 GDAL/OGR/PROJ4 libraries

Installing these libraries on Mac is not required for the Geo-scripting course as the rgdal and rgeos R package contain the GDAL C++ library. However, they will come in handy if reprojecting data represent a large part of your work or if you plan on doing a lot of file format conversions. They are an absolute necessity if you have to work with hdf4 format data.

The best option for install RGDAL on mac is via the Kynchaos website. At the time of writing this description install the set if you the GDAL library (not required for the course). Check out a tutorial if you need more info.

4.1.3 Version control software

Installing these software is not an absolute necessity, however it might come handy if you plan to implement some of the good practices discussed in Lesson 2. Refer to Lesson 2 for more details.

Most likely you need one OR the other, depending on whether your repository is hosted on a git or Subversion version control system. Only git is required if you plan to follow the full tutorial of Lesson 2. See here for an excellent and clear description for how to install SVN and Git on Mac so that you can use it within RStudio. RStudio IDE should automatically be able to find SVN and Git.

See here for more info if needed: (1) extra info for OSX. Git should be available to via Xcode, or (2) this question helps.

4.1.4 Specific R packages

Not all packages are hosted on the CRAN package repository, this is the case for instance of the MODIS package that is maintained on R Forge, and requires an extra argument in the install.packages() function to be installed. The install line, to be copy pasted in the R shell is often given on the package R forge home page.

4.1.5 Extra help

Other links where you can find help: