Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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