ST_ReducePrecision
What is ST_ReducePrecision?
ST_ReducePrecision is a PostGIS function that snaps the vertices of a geometry to a regular grid of the specified size, while preserving the geometry's validity. It is the modern replacement for ST_SnapToGrid when topological correctness matters.
ST_ReducePrecision(geometry geom, float gridsize) → geometrygridsize is the spacing of the snap grid in the input's SRID units. A gridsize of 0.01 snaps to the nearest hundredth of a unit.
When would you use ST_ReducePrecision?
Use ST_ReducePrecision to reduce storage size, normalise precision across datasets, or prepare input for operations that are sensitive to tiny coordinate differences (such as overlay and union). Unlike ST_SnapToGrid, it will not invalidate geometries — collapsed edges or invalid polygons are handled by GEOS's precision model.
1UPDATE parcels
2SET geom = ST_ReducePrecision(geom, 0.001);FAQs
How is this different from ST_SnapToGrid?
ST_SnapToGrid just rounds every vertex to the grid — which can produce invalid polygons (self-intersections, zero-area rings). ST_ReducePrecision uses GEOS's precision-reduction algorithm, which guarantees the output remains valid by collapsing or reshaping features as needed.
What happens to very small features?
Features smaller than the grid size may collapse entirely. A sliver polygon narrower than gridsize can become a line or disappear; a very short line can reduce to a point. Check the output geometry type if this matters.
How do I choose a gridsize?
Pick the smallest grid that still preserves the detail you care about. For survey-grade data keep gridsize below your positional accuracy (e.g. 0.01 for metre-accurate data); for cartographic simplification use larger values. Aggressive rounding shrinks storage but destroys detail.
Is this CRS-aware?
The grid is in the units of the input SRID. For EPSG:4326 a gridsize of 0.00001 is about 1 metre at the equator but 0.3 metres at 70° latitude — for metre-accurate precision on geographic data, reproject first.