[PostGIS] #4283: ST_CurveToLine duplicates last point when linearizing circle

PostGIS trac at osgeo.org
Mon Dec 22 11:31:15 PST 2025


#4283: ST_CurveToLine duplicates last point when linearizing circle
----------------------+---------------------------
  Reporter:  dbaston  |      Owner:  pramsey
      Type:  defect   |     Status:  closed
  Priority:  medium   |  Milestone:  PostGIS 2.5.2
 Component:  postgis  |    Version:  2.5.x -- EOL
Resolution:  fixed    |   Keywords:
----------------------+---------------------------
Comment (by dbaston):

 I'm a little confused about the fix here. (Unfortunately I didn't put the
 original output in the ticket, so I can't see what the problem was in
 2.5).

 Linearizing a circle with 10 segments per quadrant should produce 40
 segments / 41 vertices in the output, no? (The original test result). The
 following query in PostGIS 3.4.2 shows 39 segments of approximately equal
 length, except for the final segment which is double the length of the
 others:

 {{{
 dan=# SELECT ST_Length((ST_DumpSegments(ST_CurveToLine('CIRCULARSTRING (0
 0, 1 0, 0 0)', 10, 0, 1))).geom);
       st_length
 ---------------------
  0.07845909572784487
  0.07845909572784494
  0.07845909572784497
  0.07845909572784492
  0.07845909572784496
  0.07845909572784496
  0.07845909572784492
  0.07845909572784497
  0.07845909572784492
  0.07845909572784494
  0.07845909572784499
  0.07845909572784492
    0.078459095727845
  0.07845909572784487
    0.078459095727845
  0.07845909572784494
  0.07845909572784494
  0.07845909572784497
  0.07845909572784492
  0.07845909572784494
  0.07845909572784494
  0.07845909572784494
  0.07845909572784494
  0.07845909572784497
  0.07845909572784492
  0.07845909572784492
  0.07845909572784497
  0.07845909572784494
  0.07845909572784492
    0.078459095727845
  0.07845909572784442
  0.07845909572784542
  0.07845909572784539
   0.0784590957278445
  0.07845909572784451
  0.07845909572784537
  0.07845909572784537
  0.07845909572784447
  0.15643446504023106
 (39 rows)
 }}}

 On the other hand, running the query above with {{{CIRCULARSTRING (0 0,
 0.5 0.5, 1 0, 0.5 -0.5, 0 0)}}} as the input gives 40 segments of
 approximately equal length.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4283#comment:6>
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