Skip to content
← Back to Spatial Analysis
spatial-analysisIntermediate· 6 min read

Interpolation and Density Analysis: From Points to Surfaces

How IDW, TIN and kriging estimate values between measurements, why density analysis answers a different question, and how to check an interpolation against held-back points.

Two different problems

Points on a map can mean two things.

Sometimes each point carries a measurement: the temperature at a weather station, the depth of a well, the height of a survey mark. The question is what the value is between the points. That is interpolation, and the output is a continuous surface of the measured variable.

Sometimes each point only marks that something happened or exists: a hospital, a road accident, a tree. The question is how concentrated they are. That is density analysis, and the output is a surface of how many points there are per unit area.

Mixing them up produces maps that look fine and mean nothing. Interpolating the number of hospitals across a city, for example, has no sensible reading.

Interpolation methods

Inverse distance weighting

IDW estimates a value as a weighted average of nearby samples, with closer samples counting more. A power value controls how fast the weight falls with distance. A higher power makes the surface follow the nearest sample, and a lower one smooths it. IDW cannot produce a value above the highest sample or below the lowest, and it tends to leave small circular bumps around points.

Triangulated irregular network

A TIN joins the sample points into triangles and interpolates linearly inside each one. It passes through every sample exactly and has hard edges along the triangles. It does not extrapolate beyond the outer edge of the points.

Kriging

Kriging uses a model of how similar values are at different distances, called a variogram, to give the best linear estimate under that model. It also gives an estimate of uncertainty. It needs more care than the other two, because a poor variogram fit gives a poor surface. The spatial statistics note explains the variogram.

Checking an interpolation

An interpolated surface matches its own samples almost perfectly, so comparing it with them tells you nothing. Keep about 20 percent of the points aside, build the surface from the rest, and compare the surface with the held-back points. The root mean square error (RMSE) is the usual summary: the square root of the mean of the squared differences, in the units of the variable.

A smooth surface is not a good surface. Judge by the error on points the method has not seen.

Kernel density

Kernel density places a smooth bump over each point and adds the bumps. The radius sets how far each point's influence reaches. A small radius shows local peaks. A large radius shows broad regions. No radius is correct on its own, so pick one that matches the scale of your question and try two more.

A grid of counts is a simpler alternative. It is easier to explain, but it depends on the cell size and on where the grid starts.

Example: land surface temperature

In the QGIS tutorial, Landsat 8 surface temperature for Bengaluru gives a known surface. About 300 random points are drawn, the temperature at each is read from the raster, and roughly 20 percent are set aside as test points. IDW and TIN surfaces are built from the rest. On the test points, both methods gave errors of roughly 2.3 to 2.5 degrees Celsius, and which was slightly better changed with the random sample. With about 230 samples over 30 kilometres, the choice of method mattered less than how the samples were spread.

A heatmap of hospitals, with a 3 km radius, is the density example in the same tutorial.

Choosing a method

QuestionMethod
What is the value between my measurements?IDW, TIN or kriging
Where are the points concentrated?Kernel density or a grid count
I need an uncertainty estimateKriging
I need the surface to pass exactly through samplesTIN

Common mistakes

  • Interpolating counts of events instead of measuring a field.
  • Using too few samples, or samples bunched in one area.
  • Judging a surface by how smooth it looks.
  • Testing against the same points used to build the surface.
  • Picking a heatmap radius without trying others.
  • Interpolating in a geographic CRS, where distances are in degrees.

Glossary

TermMeaning
InterpolationEstimating values between measured points
IDWInverse distance weighting, a weighted average of nearby samples
TINA network of triangles joining the sample points
KrigingInterpolation based on a model of spatial correlation
RMSERoot mean square error, the typical size of the error
Kernel densityA smooth surface of how concentrated points are

Practise it

The tutorial Interpolation, density and heatmaps builds IDW and TIN surfaces from land surface temperature, tests them on held-back points, and draws a hospital heatmap.

Test yourself

1. Why should you not test an interpolation against the points used to build it?

The surface matches its own samples closely, so the error looks small whatever the method is. Held-back points show how it performs on places it has not seen.

2. What does the radius control in kernel density?

How far each point's influence spreads, which sets how smooth the surface is.

3. Would you interpolate the number of hospitals in each district?

No. The number of hospitals is a count of events, not a measured field that exists everywhere. Density analysis or a grid count suits it.

Quick quiz

1. Which question suits density analysis?
2. Which method always passes exactly through the sample points?
3. What does RMSE summarise?
0 of 3 answered

Key takeaways