Contouring and Surface Interpolation
Contouring
Generate contours from evenly-spaced weighted points
https://gis.stackexchange.com/questions/85968/clustering-points-in-postgresql-to-create-contour-map NO SOLUTION
Contouring Irregularly spaced points
https://abelvm.github.io/sql/contour/
Solution An impressive PostGIS-only solution using a Delaunay with triangles cut by contour lines. Uses the so-called Meandering Triangles method for isolines.
Surface Interpolation
IDW Interpolation over a grid of points
Use Inverse-Distance-Weighting (IDW) interpolation on a subset of nearby points. The power parameter POWER
is chosen according to the weighting desired..
SELECT SUM( z/d ) / SUM( 1/d ) AS z
FROM (
SELECT smpl.z as z,
ST_Distance(itp.geom, smpl.geom) ^ POWER AS d
FROM <point> AS smpl
ORDER BY
itp.geom <-> smpl.geom
WHERE smpl.Z IS NOT NULL
LIMIT <sample_size>
) t;
Compute Z value of a TIN at a Point
Solution