Introduction to R and RStudioProject management in RStudioIntroduction to R


Figure 1

RStudio project logo with five lines, each leading from the logo towards one of the five boxes with texts: 'data/', 'data_output/', 'documents/', 'fig_output/', 'scripts/'
R project organization

Data Structures


Exploring Data Frames & Data frame Manipulation with dplyrExploring Data framesData frame Manipulation with dplyr


Figure 1

A data frame
Source: Data Carpentry R for Social Scientists


Introduction to visualisationIntroduction to VisualisationWriting data


Figure 1


Figure 2


Figure 3


Figure 4


Figure 5


Figure 6


Figure 7


Figure 8


Introduction to Geospatial Concepts


Figure 1

The shape of the Earth. Source: United Nations Statistics Division and International Cartographic Association (2012a).
The shape of the Earth. Source: United Nations Statistics Division and International Cartographic Association (2012a).

Figure 2

Geographical latitude and longitude. Source: van der Marel (2014).
Geographical latitude and longitude. Source: van der Marel (2014).

Figure 3

Map projection represented as flattening an orange peel. Source: Data Carpentry (2023).
Map projection represented as flattening an orange peel. Source: Data Carpentry (2023).

Figure 4

Cylindrical, conic, and azimuthal map projections. Source: Knippers (2009).
Cylindrical, conic, and azimuthal map projections. Source: Knippers (2009).

Figure 5

Rotterdam in two different CRS
Rotterdam in two different CRS

Figure 6


Open and Plot Vector Layers


Figure 1


Explore and plot by vector layer attributesQuery Vector Feature Metadata


Figure 1

Map of cycleways in Delft.
Map of cycleways in Delft.

Figure 2


Figure 3


Figure 4


Figure 5


Figure 6


Figure 7

Mobility network in Delft using thicker lines than the previous example.
Mobility network in Delft using thicker lines than the previous example.

Figure 8

Map of the mobility network in Delft with large-font and border around the legend.
Map of the mobility network in Delft with large-font and border around the legend.

Figure 9


Figure 10


Plot multiple shapefiles


Figure 1


Figure 2


Figure 3


Figure 4


Figure 5


Handling Spatial Projections & CRS


Figure 1


Figure 2


Figure 3


Figure 4


Intro to Raster Data


Figure 1

Raster plot with `ggplot2` using the viridis color scale
Raster plot with ggplot2 using the viridis color scale

Figure 2

Single- and multi-band raster
Single- and multi-band raster

Figure 3


Figure 4


Plot Raster Data


Figure 1


Figure 2


Figure 3

The plot above uses the default colours inside ggplot2 for raster objects. We can specify our own colours to make the plot look a little nicer. R has a built in set of colours for plotting terrain, which are built in to the terrain.colors() function. Since we have three bins, we want to create a 3-colour palette:


Figure 4


Figure 5

The axis labels x and y are not necessary, so we can turn them off by passing element_blank() to the relevant part of the theme() function.


Figure 6


Figure 7


Reproject Raster Data


Figure 1

Our results are curious - neither the Digital Terrain Model (DTM_TUD_df) nor the DTM Hillshade (DTM_hill_TUD_df) plotted. Let’s try to plot the DTM on its own to make sure there are data there.


Figure 2


Figure 3


Figure 4


Raster Calculations


Figure 1

Source: National Ecological Observatory Network (NEON).
Source: National Ecological Observatory Network (NEON).

Figure 2


Figure 3


Figure 4


Figure 5

Notice that the range of values for the output CHM starts right below 0 and ranges to almost 100 meters. Does this make sense for buildings and trees in Delft?


Figure 6


Figure 7


Work with Multi-Band Rasters


Figure 1


Figure 2


Figure 3

And a raster plot of the second band:


Figure 4


Figure 5


Import and Visualise OSM Data


Figure 1

The result looks like this:


Figure 2

Brielle, Netherlands
Brielle, Netherlands

Figure 3

Brielle, New Jersey
Brielle, New Jersey

Figure 4

The OSMdata Documentation page
The OSMdata Documentation page

Figure 5

The Overpass Query Documentation page
The Overpass Query Documentation page

Figure 6


Basic GIS operations with R and sf


Figure 1


Figure 2


Figure 3


Figure 4


Figure 5


Figure 6


Figure 7