ST_SimplifyPolygonHull
What is ST_SimplifyPolygonHull?
ST_SimplifyPolygonHull is a PostGIS function that computes a simplified hull of a polygon — either an outer hull (containing the input) or an inner hull (contained by the input) — while preserving validity. The degree of simplification is controlled by a target vertex ratio.
ST_SimplifyPolygonHull(geometry param_geom, float vertex_fraction, boolean is_outer = true) → geometryvertex_fraction is a value between 0 and 1 specifying the target fraction of input vertices to keep. is_outer = true returns a polygon containing the input; is_outer = false returns one contained by it.
When would you use ST_SimplifyPolygonHull?
Use ST_SimplifyPolygonHull when you need a controlled, topology-safe approximation of a polygon that is guaranteed to lie inside or outside it — for example generating a simplified buffer that is guaranteed not to undercount area, or an approximation of the interior for indexing. It is a powerful middle ground between exact geometry and convex hull.
1SELECT id, ST_SimplifyPolygonHull(geom, 0.3, true) AS outer_hull
2FROM lakes;FAQs
How is this different from ST_SimplifyPreserveTopology?
ST_SimplifyPreserveTopology approximates the polygon with no containment guarantee — it can shift edges inward or outward. ST_SimplifyPolygonHull produces a hull that strictly contains or is contained by the original, which matters when you need containment semantics (e.g. approximate envelopes for spatial indexing).
What does the vertex_fraction parameter mean?
It is the target fraction of the input's vertex count. 0.1 aims for 10% of the original vertices (heavy simplification); 0.9 keeps 90%. The actual count can differ slightly because vertex preservation depends on the algorithm's constraints.
When should I use outer versus inner hull?
Use an outer hull (is_outer = true) when you need to guarantee coverage — for example approximating a service area that must contain the true area. Use an inner hull when you need a safe "always inside" region for indexing or point-in-polygon tests.
Does it work on MultiPolygons?
Yes. Each component polygon is simplified independently to the same fraction. For mixed-size components, the result may look under- or over-simplified on individual parts; in that case split with ST_Dump and apply per-part fractions if needed.