Turns out that all of the geometries that couldn't be divided by ST_SnapToGrid
had form of xx.xxxxxxx9999999x
, where x
is a digit. That means, that if I want its precision to be centimetric, it's safe to treat such geometries as a number and just round it mathematically, all of them will round to the higher number.
After such process, they matched with the geometries I should get after reducing precision.
So, first I snapped the X and Y geometries separately, then rounded them and recreated geometry from concatenated string.
ST_GeomFromText(concat(
'POINT (',
round(ST_X(ST_SnapToGrid(point, 0.0000001))::numeric, 7),
' ',
round(ST_Y(ST_SnapToGrid(point, 0.0000001))::numeric, 7),
')'
))
ST_AsText
had an optional precision operand, but it doesn't. – Vince May 6 at 11:07ST_AsTWKB
roundtrip. – ThingumaBob May 6 at 15:27