ST_SnapToGrid vs. ST_ReducePrecision - any difference for non-polygons ?

Sandro Santilli strk at kbt.io
Tue Apr 29 03:39:32 PDT 2025


When the input is a line, is there any known difference between
ST_SnapToGrid and ST_ReducePrecision ?
Or, is the ONLY difference related to polygons ?

Example of identical results:

 ST_SnapToGrid(     'MULTIPOINT(5 0, 5.02 0)', 1); -- MULTIPOINT(5 0,5 0)
 ST_ReducePrecision('MULTIPOINT(5 0, 5.02 0)', 1); -- MULTIPOINT(5 0,5 0)
 
 ST_SnapToGrid(     'LINESTRING(5 0, 5.02 0)', 1); -- LINESTRING EMPTY
 ST_ReducePrecision('LINESTRING(5 0, 5.02 0)', 1); -- LINESTRING EMPTY

 ST_SnapToGrid(     'LINESTRING(5 0, 5 5, 5.02 0)', 1); -- LINESTRING(5 0,5 5,5 0)
 ST_ReducePrecision('LINESTRING(5 0, 5 5, 5.02 0)', 1); -- LINESTRING(5 0,5 5,5 0)

--strk;

  Libre GIS consultant/developer 🎺
  https://strk.kbt.io/services.html


More information about the postgis-devel mailing list