Setup for GIS

Last updated on 2025-07-01 | Edit this page

Overview

Questions

  • How do I get ready for working with geospatial data in R?

Objectives

  • Get your R-environment prepared for working with geospatial data

This workshop is designed to be run on your local machine. First, you will need to download the data we use in the workshop. Then, you need to set up your machine to analyse and process geospatial data. We provide instructions below to install all components manually.

Data


For a full description of the data used in this workshop see the data page.

Note that the page includes a lot of other datasets, not just GIS-related.

Local Installation


Software

Software Install Manual Available for Description
R Link Link Linux, MacOS Software environment for statistical and scientific computing
RStudio Link Linux, MacOS GUI for R

We provide quick instructions below for installing the various software needed for this workshop. At points, they assume familiarity with the command line and with installation in general. As there are different operating systems and many different versions of operating systems and environments, these may not work on your computer. If an installation doesn’t work for you, please refer to the installation instructions for that software listed in the table above.

UDUNITS

Linux users will have to install UDUNITS separately. Like the geospatial libraries discussed above, this is a dependency for the R package sf. Due to conflicts, it does not install properly on Linux machines when installed as part of the sf installation process. It is therefore necessary to install it using the command line ahead of time.

Steps for installing the geospatial will vary based on which form of Linux you are using. These instructions are adapted from the sf package’s README.

For Ubuntu:

BASH

$ sudo apt-get install libudunits2-dev

For Fedora:

BASH

$ sudo dnf install udunits2-devel

For Arch:

BASH

$ pacaur/yaourt/whatever -S udunits

For Debian:

BASH

$ sudo apt-get install -y libudunits2-dev

R Packages

The following R packages are used in the various geospatial lessons. If you have taken other of our cources, you probably have a number of them installed already.

To install these packages in RStudio, copy the following into the console and hit enter.

R

install.packages(c("dplyr", "ggplot2", "raster", "rasterVis", "RColorBrewer", "remotes", "reshape", "scales", "sf", , "tidyr", "maps"))

You should see a status message starting with: terra skal nok også være der et sted. men det fejler i git-actions.

OUTPUT

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/dplyr_0.7.6.tgz'
Content type 'application/x-gzip' length 5686536 bytes (5.4 MB)
==================================================
downloaded 5.4 MB

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/ggplot2_3.0.0.tgz'
Content type 'application/x-gzip' length 3577658 bytes (3.4 MB)
==================================================
downloaded 3.4 MB

When the installation is complete, you will see a status message like:

OUTPUT

The downloaded binary packages are in
/var/folders/7g/r8_n81y534z0vy5hxc6dx1t00000gn/T//RtmpJECKXM/downloaded_packages

You are now ready for the workshop!

Key Points

  • Working with geospatial data requires additional software