Name

ST_ReducePrecision — Returns a valid geometry with all points rounded to the provided grid tolerance.

Synopsis

geometry ST_ReducePrecision(geometry g, float8 gridsize);

Description

Returns a valid geometry with all points rounded to the provided grid tolerance, and features below the tolerance removed.

Unlike ST_SnapToGrid the returned geometry will be valid, with no ring self-intersections or collapsed components.

Availability: 3.1.0 - requires GEOS >= 3.9.0.

Examples

SELECT ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 0.1));
    st_astext
-----------------
 POINT(1.4 19.3)

SELECT ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 1.0));
  st_astext
-------------
 POINT(1 19)

 SELECT ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 10));
  st_astext
-------------
 POINT(0 20)

See Also

ST_SnapToGrid, ST_Simplify, ST_SimplifyVW