Opened 4 years ago

Last modified 3 years ago

#4896 new enhancement

Allow ST_Boundary() to return start/end point of closed LineString

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS Fund Me
Component: postgis Version:
Keywords: Cc:

Description

At the moment ST_Boundary() returns an EMPTY geometry when called against closed linestrings. This makes sense from a topological point of view, but in some cases you may want to get an official startpoint and it's currently annoyingly hard to get that, especially for multilines.

I think we do support some kind of BoundaryNodeRule for other operations, and then I guess it would be nice to have for ST_Boundary as well.

What do you think DrJTS ?

Change History (8)

comment:2 by komzpa, 4 years ago

I believe ST_StartPoint should be allowed to run on any geometry instead.

comment:3 by strk, 4 years ago

What would your ST_StartPoint return against a MULTILINESTRING((0 0, 20 0, 10 5, 0 0),(100 0, 120 0)) ?

An ST_Boundary() with BoundaryNodeRule 2 would return MULTIPOINT((0 0), (100 0), (120 0)) . Note how BOTH start and end points are returned for the second geometry…

in reply to:  3 comment:4 by mdavis, 4 years ago

Replying to strk:

What would your ST_StartPoint return against a MULTILINESTRING((0 0, 20 0, 10 5, 0 0),(100 0, 120 0)) ?

Perhaps ST_StartPoint could be extended to support MultiLineStrings as input (returning a MultiPoint containing the start points of each element)?

comment:5 by mdavis, 4 years ago

This is the one of the reasons that the BoundaryNodeRule concept was introduced in JTS: it's handy to be able to use it to get the node point of closed LineStrings. (And it also allows getting the endpoints of degree 1 in a MultiLineString, rather than being hostage to the less-useful Mod-2 rule of the standard.

So +1 for adding BoundaryNodeRule support to ST_Boundary, especially since it is already provided for ST_Relate.

comment:6 by pramsey, 3 years ago

Owner: changed from pramsey to komzpa

comment:7 by komzpa, 3 years ago

Owner: changed from komzpa to strk

comment:8 by komzpa, 3 years ago

Milestone: PostGIS 3.2.0PostGIS Fund Me
Note: See TracTickets for help on using tickets.