[postgis-tickets] [PostGIS] #3929: Unexpected rounding from ST_SnapToGrid
PostGIS
trac at osgeo.org
Sat Nov 18 07:16:18 PST 2017
#3929: Unexpected rounding from ST_SnapToGrid
----------------------+---------------------------
Reporter: michaudm | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.4.2
Component: postgis | Version: 2.4.x
Keywords: |
----------------------+---------------------------
I would expect that
ST_Equals(ST_GeomFromText('POINT(311.4 0)'),
ST_SnapToGrid(ST_GeomFromText('POINT(311.4 0)'), 0.1));
but it returns FALSE;
The x value returned by snaprounding "seems" to be as close as possible
from 311.4
SELECT ST_X(ST_GeomFromText('POINT(0 311.4)'));
-> display 311.4
But while
SELECT ST_X(ST_GeomFromText('POINT(311.4 0)'))-311.4
display 0
SELECT ST_X(ST_SnapToGrid(ST_GeomFromText('POINT(311.4 0)'), 0.1))-311.4
display 5.6843418860808e-014
x-value is not the same after snap rounding.
My use case was :
I want to check that all my coordinates are decimetric.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3929>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list