Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2412 closed defect (fixed)

st_linetocurve('LINESTRING(0 0, 10 0)') -- ERROR: pta_desegmentize needs implementation for npoints < 4

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.0.4
Component: postgis Version: 1.5.X
Keywords: history Cc:

Description

It looks like you can't convert a 2-points line to a curve, but the message is not friendly:

ERROR:  pta_desegmentize needs implementation for npoints < 4

Should the code aim to return a COMPOUNDCURVE containing a single linestring in these cases ? That's what would cleanly convert back to the original input

Affected versions from 1.5.x to 2.2

Change History (5)

comment:1 Changed 6 years ago by strk

Type: defectenhancement

This is actually an enhancement

comment:2 Changed 6 years ago by strk

Owner: changed from pramsey to strk
Status: newassigned
Type: enhancementdefect

On a second thought, this isn't really an enhancement, because ST_LineToCurve already returns non-curved elements as straight lines, and this case is not different. So the correct answer here would be to return a LINESTRING (same as the input).

comment:3 Changed 6 years ago by strk

For comparison, this works fine:

=# select st_astext(st_linetocurve('LINESTRING(0 0, 10 0, 20 0, 30 0)'));
           st_astext            
--------------------------------
 LINESTRING(0 0,10 0,20 0,30 0)
(1 row)

comment:4 Changed 6 years ago by strk

Resolution: fixed
Status: assignedclosed

Fixed by returning the straight line with r11765 in trunk (2.2.0), r11766 in 2.1 branch (2.1.0), r11767 in 2.0 branch (2.0.4).

comment:5 Changed 6 years ago by robe

Keywords: history added
Note: See TracTickets for help on using tickets.