Spatial Interpolation in Python using Inverse Distance Weighting

Johan Louwers
4 min readSep 18, 2023
Inverse Distance Weighting

Inverse Distance Weighting (IDW) is a commonly used method in geostatistics for spatial interpolation. It’s particularly useful when you have sampled data points at specific locations and you want to estimate values at unobserved locations within the same area.

Imagine you have a set of data points, each with a known value, and you want to predict values at other locations. IDW works by considering the distances between the target location and the known data points.

For each known point, a weight is calculated based on its distance from the target location. Closer points have more influence, while farther points have less. The weight is determined by the inverse of the distance raised to a power (often denoted as p). The choice of p controls how quickly the influence of points diminishes with distance.

Once the weights are determined, each known value is multiplied by its corresponding weight, resulting in weighted values. These are then combined to obtain an estimated value at the target location.

The estimated value is found by taking the weighted average of the known values. The sum of the weights is used to properly weight each contribution.

Inverse Distance Weighting is widely used in fields like geography, environmental science…

--

--

Johan Louwers

Johan Louwers is a technology enthousiasts with a long background in supporting enterprises and startups alike as CTO, Chief Enterprise Architect and developer.