Opened 7 years ago

Last modified 2 years ago

#2192 new enhancement

Add tolerance parameter to ST_Split for splitting lines by points

Reported by: michischolz Owned by: pramsey
Priority: medium Milestone: PostGIS Fund Me
Component: postgis Version: 2.0.x
Keywords: st_split, tolerance, gsoc Cc:

Description

Heho. ST_Split does not work well when splitting a line by a point. Consider the following example where the line is not split even though the blade is supposed to be a point on the line:

SELECT ST_AsText((ST_Dump(ST_Split(lin.geom, ST_Line_Interpolate_Point(lin.geom, 0.5)))).geom) AS geom
FROM (SELECT ST_GeomFromText('LINESTRING(604630.408 5792499.778,604623.849 5792500.886)') AS geom) AS lin

For the case of a line split by a point some kind of tolerance parameter would help. Until now I it is necessary first to ST_Snap your line to that interpolated point before splitting it by the point, which is not straightforward (thanks to strk for this hint). At least you could mention this hint in the documentation.

Attachments (1)

reference_processing.xml.patch (855 bytes) - added by michischolz 7 years ago.
Patch of documentation for ST_Split

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by robe

Component: postgisdocumentation
Owner: changed from pramsey to robe

comment:2 Changed 7 years ago by strk

Component: documentationpostgis
Milestone: PostGIS 2.0.3PostGIS 2.1.0
Owner: changed from robe to pramsey

New parameter requires minor version upgrade. michischolz: a patch for documentation is welcome

Changed 7 years ago by michischolz

Patch of documentation for ST_Split

comment:3 Changed 7 years ago by robe

Keywords: gsoc added

Okay incorporated the doco patch for 2.0 at r11251 and 2.1 at r11252

adding feature to google summer of code candidate list. http://trac.osgeo.org/postgis/wiki/GoogleSummerCode

comment:4 Changed 7 years ago by robe

Milestone: PostGIS 2.1.0PostGIS 2.2.0

comment:5 Changed 5 years ago by pramsey

Milestone: PostGIS 2.2.0PostGIS Future

comment:6 Changed 3 years ago by worthlutz

I ran into this problem and this ticket showed up on Google. I was a bit confused trying to use ST_Snap as hinted at above. It took me a while to understand that I needed to snap the line to the point instead of the opposite. I am adding this comment to help others.

Here is my query:

SELECT
    ST_AsText( ST_LineInterpolatePoint(the_geom, 0.5) ) AS the_point_geom,
    
    ST_AsText(
        (ST_Dump(
            ST_Split( 
                ST_Snap( the_geom, ST_LineInterpolatePoint(the_geom, 0.5), 0.00000001 ), 
                ST_LineInterpolatePoint(the_geom, 0.5)
            )
        )).geom
    ) AS the_new_line_geom
    
FROM street_segments
WHERE id = 2085426
Last edited 3 years ago by worthlutz (previous) (diff)

comment:7 Changed 2 years ago by robe

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.