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.

In QGIS, I would like to split the polylines in a layer loaded in the workspace with the points in another loaded layer. If a point intersects a polyline, this polyline should be transformed into two polylines...

I've read that this could be done with grass but i have no idea how to do it with layers (SHP)loaded in the QGIS workspace.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You can see solutions using GRASS here

There's also another option with Spatialite. The newest version 4.0 has a function LinesCutAtNodes() which does what you want. You feed it a linestring geometry and a point geometry, and it returns a linestring split wherever a point exactly intersect a vertex on the line. The points have to intersect vertices on the line, so you should do snap() first to get the points to exactly intersect the line vertices.

share|improve this answer
    
Thanks for your answer. I do not have SQLIte to use those functions but i do use Postgis. In fact the layers i loaded in the QGIS Map Canvas are loaded from postgis. Is there any similar function in Postgis? I've seen that st_snap() exists but nothing similar to Spatialites LinesCutAtNodes()? –  Aitor Feb 1 '13 at 17:18
1  
In PostGIS you could probably use a combination of ST_Line_Locate_Point() to find the fractional distance along your linestring for each point, then ST_Line_Interpolate_Point() to find the new node. and finally ST_AddPoint() to stick a the node into the linestring. THis would all have to go into a function with a "for each" loop. –  Micha Feb 2 '13 at 18:35

For PostGIS ST_Split is the maching function. You can use ST_Snap to add some tolerance into the calculation

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.