Opened 13 years ago

Closed 13 years ago

#1500 closed enhancement (fixed)

ST_MakeLine accepting line input

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

When dealing with topology it is useful to have a simple function that "sews" linestrings together respecting their ordering and direction.

ST_LineMerge reverse lines as needed to find connection while the ST_ConcatenateLines should no nothing more than the sewing itself. No reversing, no reordering of arguments.

The input should be already prepared to be an ordered array of linestring where the first point of each matches the end point of the previous. A single instance of the common vertex should be included in the result.

The function should allow to construct non-simple lines, fully trusting and respecting the user input.

Optionally (but not by default) the function might allow "patching" a gap between components by adding an additional segment connecting them (from end point of first to start point of second).

Un-sewable conditions should be reported by throwing an exception.

Would be nice to have this in 2.0.0, but we can probably also introduce it in 2.0.1 with no major drama.

Change History (4)

comment:1 by strk, 13 years ago

Summary: ST_ConcatenateLines(line1, line2)ST_AppendLine(line1, line2, [gap_tolerance])

AppendLine is likely a better name as it makes it clearer that it should be considered a method of the first line.

BTW, did we ever experiment about accepting a typed geometry ? Like:

 ST_AppendLine(line1 geometry(line), line2 geometry(line), gapTol float8 DEFAULT 0)

comment:2 by strk, 13 years ago

Summary: ST_AppendLine(line1, line2, [gap_tolerance])ST_AppendLine(line1, line2, [gap_tolerance]) or ST_MakeLine accepting line input

Another idea, which avoids to add yet another signature, could be enhancing ST_MakeLine to also accept line inputs. You could then mix points and lines in a chain of components for a line. In this case the function would always fill the gaps between lines, for consistency with what it already does with points. Also it would not drop the duplicate vertex at the sewing point.

comment:3 by strk, 13 years ago

r8926 implements the liblwgeom side of it, supporting gap tolerance of NONE, a number and ANY. For my own use in topology the SQL level can be w/out the whistles thus simply enhancing ST_MakeLine to accept line args. It would default to ANY tolerance …

comment:4 by strk, 13 years ago

Resolution: fixed
Status: newclosed
Summary: ST_AppendLine(line1, line2, [gap_tolerance]) or ST_MakeLine accepting line inputST_MakeLine accepting line input

r8931 adds the support in ST_MakeLine.

The version with gap_tolerance I don't really need anymore, so closing this as done.

Note: See TracTickets for help on using tickets.