Opened 4 years ago

Closed 4 years ago

#4698 closed enhancement (fixed)

Add precision parameter to ST_AsEWKT

Reported by: Algunenano Owned by: pramsey
Priority: medium Milestone: PostGIS 3.1.0
Component: postgis Version: master
Keywords: Cc:

Description

While working in the shortest representation for doubles I've noticed an approach used multiple times to print a EWKT (i.e. with the SRID) up to a certain precision:

SELECT ST_AsEWKT(ST_SnapToGrid(g, 0.01))

This approach is wrong because ST_SnapToGrid does not guarantee that the coordinates will fall into that precision; and it really can't, since there might not be a floating point representation for that number.

Instead, what I think should be available is

SELECT ST_AsEWKT(g, 2)

And leave ST_SnapToGrid to its real use case, gridding (which is why it does stuff like removing duplicates).

Change History (2)

comment:2 by Raúl Marín <git@…>, 4 years ago

Resolution: fixed
Status: newclosed

In f0822be/git:

Add precision parameter to ST_AsEWKT

Closes #4698
Closes https://github.com/postgis/postgis/pull/575

Note: See TracTickets for help on using tickets.