# Preface

Data science is concerned with finding answers to questions on the basis of available data, and communicating that effort. Besides showing the results, this communication involves sharing the data used, but also exposing the path that led to the answers in a comprehensive and reproducible way. It also acknowledges the fact that available data may not be sufficient to answer questions, and that any answers are conditional on the data collection or sampling protocols employed.

This book introduces and explains the concepts underlying spatial data: points, lines, polygons, rasters, coverages, geometry attributes, data cubes, reference systems, as well as higher-level concepts including how attributes relate to geometries and how this affects analysis. The relationship of attributes to geometries is known as support, and changing support also changes the characteristics of attributes. Some data generation processes are continuous in space, and may be observed everywhere. Others are discrete, observed in tesselated containers. In modern spatial data analysis, tesellated methods are often used for all data, extending across the legacy partition into point process, geostatistical and lattice models. It is support (and the understanding of support) that underlies the importance of spatial representation. The book aims at data scientists who want to get a grip on using spatial data in their analysis. To exemplify how to do things, it uses R.

It is often thought that spatial data boils down to having observations’ longitude and latitude in a dataset, and treating these just like any other variable. This carries the risk of missed opportunities and meaningless analyses. For instance,

• coordinate pairs really are pairs, and lose much of their meaning when treated independently
• rather than having point locations, observations are often associated with spatial lines, areas, or grid cells
• spatial distances between observations are often not well represented by straight-line distances, but by great circle distances, distances through networks, or by measuring the effort it takes getting from A to B

We introduce the concepts behind spatial data, coordinate reference systems, spatial analysis, and introduce a number of packages, including sf (Pebesma 2018, E. Pebesma (2019b)), lwgeom (E. Pebesma 2019a), and stars (E. Pebesma 2019c), as well as a number of tidyverse (Wickham 2017) extensions, and a number of spatial analysis packages that can be used with these packages, including gstat (Pebesma and Graeler 2019), spdep (R. Bivand 2019b) and spatstat (Baddeley, Turner, and Rubak 2018).

### References

Baddeley, Adrian, Rolf Turner, and Ege Rubak. 2018. Spatstat: Spatial Point Pattern Analysis, Model- Fitting, Simulation, Tests. https://CRAN.R-project.org/package=spatstat.

Bivand, Roger. 2019b. Spdep: Spatial Dependence: Weighting Schemes, Statistics. https://github.com/r-spatial/spdep/.

Pebesma, Edzer. 2018. “Simple Features for R: Standardized Support for Spatial Vector Data.” The R Journal 10 (1): 439–46. doi:10.32614/RJ-2018-009.

Pebesma, Edzer. 2019a. Lwgeom: Bindings to Selected ’Liblwgeom’ Functions for Simple Features. https://CRAN.R-project.org/package=lwgeom.

Pebesma, Edzer. 2019b. Sf: Simple Features for R.

Pebesma, Edzer. 2019c. Stars: Spatiotemporal Arrays, Raster and Vector Data Cubes. https://github.com/r-spatial/stars/.

Pebesma, Edzer, and Benedikt Graeler. 2019. Gstat: Spatial and Spatio-Temporal Geostatistical Modelling, Prediction and Simulation. https://github.com/r-spatial/gstat/.