Arman Pouyaei Start a conversation
Lesson 27  ·  Nov 9, 2026
Data Engineering Fundamentals

Raster vs. vector: grids and shapes

Every geospatial dataset you will ever meet is one of two shapes. Vector data describes discrete features — a station, a road, a county — as points, lines and polygons with attributes attached. Raster data describes a continuous field — temperature, rainfall, elevation — as a grid of cells, one value per cell. Everything in Phase 2 so far was vector; this lesson is the other half.

The code

import numpy as np

# RASTER: a grid of cells, one value per cell (here: temperature in °C)
temp_grid = np.array([
    [21.0, 21.5, 22.0],
    [20.5, 23.0, 22.5],
    [20.0, 21.0, 21.5],
])

print(temp_grid.mean())   # average over the whole area: 21.44
print(temp_grid.max())    # hottest cell: 23.0
print(temp_grid[1, 1])    # the centre cell itself: 23.0

In practice

The grid is the data model: rows and columns give each cell its position, so no coordinates are stored per cell — only a cell size (the resolution), an origin, and one value per cell. Halve the cell size and the same area needs four times the cells; resolution is the raster version of a file-size dial.

Vector is the opposite trade: exact boundaries and rich attributes per feature, nothing stored for the empty space between features. Stations, storm tracks, county boundaries, river lines: vector. Temperature fields, rainfall, satellite imagery, your gridded model output at MSCI: raster.

Real pipelines mix them constantly. The classic move is sampling: take the stations (vector) and look up the rainfall raster's value at each station's cell, giving every station a rainfall number to join against its readings. Formats follow the split — vector lives in GeoParquet (Lesson 24), raster lives in GeoTIFF, and tomorrow's lesson is the cloud-optimised version of that.

Python bridge: a raster is a NumPy array or a pandas DataFrame with spatial meaning — row and column numbers are y and x. If you can slice and aggregate an array, you can already think in raster.

Further reading

GIS Data Basics: Vector vs. Raster Data — QGIS Mierune (a short beginner walkthrough of both models, with pictures of the same place stored each way)

Try it

Practice question: classify each dataset as raster or vector: (a) county boundaries, (b) a satellite image of New Jersey, (c) river centrelines, (d) hourly rainfall over the whole state. Then, in the code above, which single line finds the hottest cell's value?

Show answer
print(temp_grid.max())    # 23.0

Result: vector: (a) county boundaries and (c) river centrelines — discrete features with exact shapes. Raster: (b) the satellite image and (d) statewide rainfall — a value in every cell, whether or not anything "is" there. The hottest cell is 23.0, found with max() — no coordinates needed, because in a raster the position is implied by the row and column.

← All posts