2.1 Introduction

This chapter will provide brief explanations of the fundamental geographic data models: vector and raster.We will introduce the theory behind each data model and the disciplines in which they predominate, before demonstrating their implementation in R.

The vector data model represents the world using points, lines and polygons.These have discrete, well-defined borders, meaning that vector datasets usually have a high level of precision (but not necessarily accuracy as we will see in Section 2.5).The raster data model divides the surface up into cells of constant size.Raster datasets are the basis of background images used in web-mapping and have been a vital source of geographic data since the origins of aerial photography and satellite-based remote sensing devices.Rasters aggregate spatially specific features to a given resolution, meaning that they are consistent over space and scalable (many worldwide raster datasets are available).

Which to use?The answer likely depends on your domain of application:

  • Vector data tends to dominate the social sciences because human settlements tend to have discrete borders.
  • Raster often dominates in environmental sciences because of the reliance on remote sensing data.
    There is much overlap in some fields and raster and vector datasets can be used together:ecologists and demographers, for example, commonly use both vector and raster data.Furthermore, it is possible to convert between the two forms (see Section 5.4).Whether your work involves more use of vector or raster datasets, it is worth understanding the underlying data model before using them, as discussed in subsequent chapters.This book uses sf and raster packages to work with vector data and raster datasets, respectively.