[postgis-users] St_snaptogrid doesn't seem to snap all the time.

Alexandre Neto senhor.neto at gmail.com
Mon Sep 14 08:25:39 PDT 2020


Hi,

I am using st_snaptogrid to reduce the number of relevant decimals places
in a linetringZ geometry.

I am using variant 4, where I give also an origin geometry, which was set
to 0,0,0,0

SELECT st_snaptogrid(geometria, st_makepoint(0,0,0,0), 0.0001, 0.0001,
0.0001, 0) as geom
FROM seg_via_rodov

Here's an example:

SELECT st_astext(geometria)
from seg_via_rodov
LIMIT 1

st_astext


                           |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
LINESTRING Z (-30237.8998031556 267117.061188696
44.1488024536882,-30236.3648673971 267121.174528336
44.1488024536882,-30234.8299319437 267125.287868282
44.1488024536882,-30233.1869835505 267129.149672231
44.1233890804773,-30231.2234287545 267132.86408063|


SELECT st_snaptogrid(geometria, st_makepoint(0,0,0,0), 0.0001, 0.0001,
0.0001, 0) as geom
FROM seg_via_rodov
LIMIT 1

geom


                            |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
LINESTRING(-30237.899800000003 267117.0612 44.1488,-30236.3649 267121.1745
44.1488,-30234.8299 267125.2879 44.1488,-30233.187 267129.1497
44.123400000000004,-30231.223400000003 267132.8641
44.058800000000005,-30228.5936 267137.1744 43.9301,-30225.93810000|


I found this old bug report, but I wonder if there's a workaround for it.

https://trac.osgeo.org/postgis/ticket/3929

Thanks,

Alexandre Neto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200914/64bd2e9a/attachment.html>


More information about the postgis-users mailing list