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

Martin Davis mtnclimb at gmail.com
Tue Apr 29 08:31:59 PDT 2025


I'm pretty sure that ST_SnapToGrid and ST_ReducePrecision provide identical
results for non-polygons.

On Tue, Apr 29, 2025 at 3:45 AM Sandro Santilli <strk at kbt.io> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20250429/dae20f5f/attachment.htm>


More information about the postgis-devel mailing list