Opened 5 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).
Note:
See TracTickets
for help on using tickets.
PR implementing it: https://github.com/postgis/postgis/pull/575