LM Data Formats

Features and differences of spatial data collected in the field or acquired by remote sensing systems.

Spatial data models

Reality is too complex to be fully represented by data. Models are a basis for reducing complexity. A data model is created through the abstraction of individual objects (entities) and their properties (attributes). In this abstraction process, objects of the same type are bundled (e.g. rivers, roads, urban areas). The spatial data world (including GIS) has implemented two different data models for this purpose – the raster model and the vector model. Both models can be used to represent continuous properties and discrete (geo-) objects in principle. In practice, however, continuous data is usually represented by the raster model and discrete data by the vector model.

R packages for spatial data

This blog post – Conversions between different spatial classes in R – explains some of the recent developments in spatial data manipulation in R as well as how to convert between them. This post mentions many different packages – sp, sf, raster, terra and stars – but what is the difference and what do we use them for?

Vector data

The package sp has been maintained since the early 2000s, but largely replaced by the functionality in sf. sf, which is short for simple features, is useful for working with point & polygon data in R.

Raster data

Much like the sp and sf combination for vector data, the packages for working with raster data have also evolved. For working with this data model, the older package raster has been superseded by the terra package. Another option, stars is designed to work with spatial data cubes – data that combines both continuous spatial data and time. The package is maintained by the same author as the sf package. See the CRAN pages of terra and stars for more details.

With multiple options for working with both types of spatial data models, which one should you choose to work with? And why are there multiple packages?

Put simply, the landscape is constantly changing. Developers must maintain their software by adding new functionality and adjusting when the software on which their own packages depend changes. Combined with an overall greater interest in working with spatial data in R and a growing community of developers, there are many reasons that it is difficult to stay up-to-date. In the case of the packages for working with raster data, the newer terra package was explicitly designed to replace raster. This is described in greater detail in this r-bloggers post. In other cases, the packages serve different use cases, which is why they co-exist.

Unit 2 slides

The PDF cannot be displayed, please try another browser or contact us.

Feel free to download this PDF to your computer.

Additional resources

Updated: