5

I have a layer that contains a master line (one big polyline) and a another layer that contains "break lines". I need to be able to split the master line at the intersection of each of these break lines.

I'm looking for a PostGIS 1.5 version of ST_Split. If I could upgrade to 2.0 I would but can't really do that at this point in time.

I thought this would be relatively easy but can't seem to find anything; or when I do it's just related to polygons being split with polylines.

Note A spatialite answer is OK

2

ST_Difference(master_line, break_lines) looks like it'll do this for you: http://www.postgis.org/documentation/manual-1.5/ST_Difference.html

# SELECT ST_AsText(ST_Difference(
                       ST_GeomFromText('LINESTRING(0 100, 0 -100)'),
                       ST_GeomFromText('LINESTRING(-100 0, 100 0)')));
                 st_astext                 
-------------------------------------------
 MULTILINESTRING((0 100,0 0),(0 0,0 -100))
(1 row)
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.