Sampling Points from Raster Data

Learn how to use the GeoPandas library in conjunction with Rasterio to perform point sampling from raster data.

We'll cover the following

Introduction

In GIS applications, we sometimes encounter phenomena that are not conveniently represented by vector structures. Instead, they might be captured more accurately as a continuous field in the form of raster data.

A raster data structure consists of a matrix of cells (or pixels) organized into rows and columns (or a grid), where each cell contains a value representing information. This form of data representation is used extensively in fields such as remote sensing, meteorology, and climate science to represent phenomena that vary continuously over space, such as temperature, elevation, or vegetation cover.

While rasters are excellent for portraying these broad, continuous fields, there may be times when we are interested in understanding how a certain phenomenon behaves at specific locations. This is where the technique of sampling points from raster data proves to be invaluable.

In essence, this technique involves selecting a set of vector points and using them to sample the underlying raster data at those points (figure below). The resulting samples can be used to analyze local variations of the phenomena, perform statistical analyses, or even feed into machine learning algorithms for predictions and classifications.

Get hands-on with 1200+ tech skills courses.