Ticket #1500 (closed enhancement: fixed)

Opened 4 months ago

Last modified 4 months ago

ST_MakeLine accepting line input

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: trunk
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

Changed 4 months ago by strk

  • summary changed from ST_ConcatenateLines(line1, line2) to 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)

Changed 4 months ago by strk

  • summary changed from ST_AppendLine(line1, line2, [gap_tolerance]) to 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.

Changed 4 months ago by strk

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 ...

Changed 4 months ago by strk

  • status changed from new to closed
  • resolution set to fixed
  • summary changed from ST_AppendLine(line1, line2, [gap_tolerance]) or ST_MakeLine accepting line input to ST_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.