Importing raster data with terra

For this chapter, you will need the following R Packages:

library(terra)
library(arc2r)

With the terra package, data is imported using the function rast.

library(terra)

swissalti3d <- terra::rast("sample_data/SWISSALTI3D_10_TIFF_CHLV95_LN02_2600_1196.tif")

Just like before, calling the object in our console will give us the class name and some meta information on the dataset.

swissalti3d

And calling plot on our object visualizes it spatially.

plot(swissalti3d)

//todo add method for rasters with multiple layers



arc2r/book documentation built on March 5, 2021, 2:10 p.m.