One thing to always ask is “why exactly am I doing this snapping operation?”
If the answer is “so my numbers look nicer in my UI” then using the second
parameter of the ST_AsText() function will give you nice, perfectly
rounded-looking outputs just like you want them.
ATB,
P
> On Sep 3, 2023,
On Mon, 4 Sept 2023 at 00:06, Sajjad Hassany Pazoky
wrote:
>
> I observed a strange behavior when using ST_SnaptoGrid.
> I don't know whether I am making a mistake or if there is a bug.
> The following code:
> SELECT ST_AsText(ST_SnapToGrid(
> ST_GeomFromText('LINESTRING(334729.13
I observed a strange behavior when using ST_SnaptoGrid.
I don't know whether I am making a mistake or if there is a bug.
The following code:
SELECT ST_AsText(ST_SnapToGrid(
ST_GeomFromText('LINESTRING(334729.13 4103548.88,334729.12
4103548.53)'),
0.001)
);
produces: