Opened 5 years ago

Closed 23 months ago

#2232 closed defect (fixed)

Accumulated error with relative coordinates in ST_AsSvg

Reported by: nicklas Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.8
Component: postgis Version: 2.0.x
Keywords: Cc:

Description (last modified by nicklas)

When using ST_ASSvg outputting relative rounded coordinates you might get accumulated rounding errors.

I saw huge errors like that when testing twkb on polygons with thousands of vertex-points.

Example:

select 
st_assvg('LINESTRING(0 0, 0.4 0, 0.8 0, 1.2 0,1.6 0, 2 0)'::geometry,1,0)

returns:

M 0 0 l 0 0 0 0 0 0 0 0 0 0

I fixed it in twkb-case in the spike with r11165, probably the same approach can be used here.

Just not get the relative value as relative to the previous coordinate, but relative to the accumulates relative coordinates achieved.

Change History (9)

comment:1 Changed 5 years ago by nicklas

Owner: changed from pramsey to nicklas
Status: newassigned

comment:2 Changed 5 years ago by nicklas

Description: modified (diff)

comment:3 Changed 4 years ago by pramsey

Milestone: PostGIS 2.0.5

comment:4 Changed 4 years ago by pramsey

Milestone: PostGIS 2.0.5PostGIS 2.0.6

comment:5 Changed 2 years ago by pramsey

Milestone: PostGIS 2.0.7PostGIS 2.0.8

comment:6 Changed 23 months ago by pramsey

Resolution: fixed
Status: assignedclosed

Fixed in 2.0 r14454, 2.1 r14455, 2.2 r14456, trunk r14457

comment:7 Changed 23 months ago by robe

Resolution: fixed
Status: closedreopened

as dbaston noted in #3383, can't use getPoint2d_cp in 2.0. So reopening this.

Good catch dbaston :)

comment:8 Changed 23 months ago by robe

Owner: changed from nicklas to pramsey
Status: reopenednew

comment:9 Changed 23 months ago by pramsey

Resolution: fixed
Status: newclosed

(In [14461]) Fix misuse of getPoint2d_cp in 2.0, closes #2232

Note: See TracTickets for help on using tickets.