R for GIS

This page is for the spatial R libraries and tools installed in the R environment in Puhti. The documentation for R in general is located in the r-environment page.


Currently supported R versions for spatial libraries:

  • 3.6.1


Loading the module

You can load the general R module with

module load r-env

Installed spatial R libraries

  • aws.s3 - for working with S3 storage, for example Allas. Example.
  • fasterize - a faster replacement for rasterize() from the 'raster' package
  • geoR - geostatistical analysis including traditional, likelihood-based and Bayesian methods
  • geoRglm - functions for inference in generalised linear spatial models, extension to the geoR package
  • geosphere - spherical trigonometry for geographic coordinates (lat, lon)
  • ggmap - map visualizations with ggplot2. As background map various online sources can be ued (e.g Google Maps and Stamen Maps). It includes tools also for geocoding and routing
  • gstat - spatial and spatio-temporal geostatistical modelling, prediction and simulation. Variogram modelling; simple, ordinary and universal point or block (co)kriging; spatio-temporal kriging; sequential Gaussian or indicator (co)simulation; variogram and variogram map plotting utility functions
  • GWmodel - geographically-weighted models: GW summary statistics, GW principal components analysis, GW discriminant analysis and various forms of GW regression
  • lidR - LiDAR data manipulation and visualization (for forestry applications), computation of metrics in area based approach, point filtering, artificial point reduction, classification from geographic data, normalization, individual tree segmentation and other manipulations
  • mapedit - interactive editing of sf objects
  • maptools
  • mapview - quickly and conveniently create interactive visualisations of spatial data with or without background maps. Attributes of displayed features are fully queryable via pop-up windows
  • ncdf4 - read, write and modify NetCDF-files
  • RandomFields - simulation and analysis of random fields
  • raster - main package for raster data
  • rgdal - bindings to GDAL and PROJ libraries, for basic data reading and writing
  • rgeos - binding to GEOS library, for topology operations on geometries
  • rlas - read and write 'las' and 'laz' file formats
  • RSAGA - for using SAGA GIS commands from R
  • sf - main package for vector data, bindings to GDAL, GEOS and PROJ libraries. Works with tidyverse packages. Similar functionality, but newer and better than sp
  • sp - older main package for vector data
  • spacetime - for working with spatio-temporal data
  • spatial - for kriging and point pattern analysis
  • spatial.tools - to enhance the core functionality of the package "raster", including a parallel processing engine for use with rasters
  • spdep - spatial dependence: weighting schemes, statistics and models
  • spatstat - for analysing point patterns
  • viridis - color maps for map plotting

You can also install your own additional libraries. Just follow the instructions in the main R page

r-env loads also:

Parallel computing

Some R packages like raster and spatial.tools include functions that support parallel computing. There is an example of using predict function from raster package in parallel among our examples.

Other than those, you have to parallelize your own R code which can be done with libraries including snow (see the documentation for the r-env module).


For finding out the correct citations for R and different R packages, you can type:

citation() # for citing R
citation("package") # for citing R packages

In your publications please acknowledge also oGIIR and CSC, for example “The authors wish to acknowledge for computational resources CSC – IT Center for Science, Finland (urn:nbn:fi:research-infras-2016072531) and the Open Geospatial Information Infrastructure for Research (oGIIR, urn:nbn:fi:research-infras-2016072513).”