7

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.

2 Answers 2

2

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.

2
  • 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()?
    – Egidi
    Feb 1, 2013 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, 2013 at 18:35
2

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

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.