[postgis-tickets] [PostGIS] #2407: [regression] ST_CurveToLine and ST_LineToCurve are not symmetric
PostGIS
trac at osgeo.org
Fri Aug 9 07:10:35 PDT 2013
#2407: [regression] ST_CurveToLine and ST_LineToCurve are not symmetric
---------------------+------------------------------------------------------
Reporter: mjurce | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.4
Component: postgis | Version: 2.0.x
Keywords: |
---------------------+------------------------------------------------------
Comment(by strk):
I shall note that translating the input curve to the origin
fixes the 2.0 round-trip behavior, pushing this bug in the class of
"precision/robustness" issues.
The offsetting query:
{{{
WITH
-- The offending input geometry
inp AS ( SELECT '
CIRCULARSTRING(718006.92 114480.27, 718006.381 114478.609, 718004.78
114477.91)
'::geometry as g
),
-- The smallest ordinate values (offset)
off AS (
SELECT ST_XMin(g) as x, ST_YMin(g) as y from inp
)
SELECT
ST_AsText(ST_Translate(ST_LineToCurve(ST_CurveToLine(ST_Translate(g,-off.x,-off.y))),
off.x,off.y))
FROM inp, off;
}}}
Gives the very good result:
{{{
CIRCULARSTRING(718006.92 114480.27,718006.396205029
114478.625955407,718004.78 114477.91)
}}}
The biggest error (computed by linearizing the curves again and computing
max distance between any vertices of the two geometries) is around 2e-06
units. Sounds very good to me!
We should maybe simply "tweak" the tolerance used by the curve detector
based on the magnitude of the ordinate values. The floating point grid is
of irregular size, can't use the same tolerance when working with arcs
near the origin or 10^6 away from it...
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2407#comment:19>
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