[postgis-tickets] [PostGIS] #4698: Add precision parameter to ST_AsEWKT

PostGIS trac at osgeo.org
Fri Jun 5 08:04:54 PDT 2020


#4698: Add precision parameter to ST_AsEWKT
-------------------------+---------------------------
 Reporter:  Algunenano   |      Owner:  pramsey
     Type:  enhancement  |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS 3.1.0
Component:  postgis      |    Version:  master
 Keywords:               |
-------------------------+---------------------------
 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).

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4698>
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