I am new to QGIS Plugins and I got something that has stressed me a lot. I want to have a layer(Linear) split whenever it intersects another feature (in another layer). I have tried with the one at:

Split a feature when intersecting with a feature of another layer using PyQGIS/Python?

and it works well. However, I want to have it split the line and not the polygon. Any help?

  • 1
    If you want to split a line with another line, you could look at the source code for the Split lines with lines algorithm :) – Joseph Mar 29 '17 at 11:56
  • Thanks Joseph for the quick response. Have checked this and the issue that might be complicating issues is that, I need to split, form a shapefile(layer) and load it on canvas.I think this is where it's getting tough – Wanjohi254 Mar 29 '17 at 12:02
  • 1
    @Wanjohi254 Did you try the Split lines with lines algorithm available from the Processing Toolbox? It seems to do what you are looking for. – mgri Mar 29 '17 at 13:01
  • Oh my. I was so much into coding my own algorithm. Hadn't seen this @mgri Thank you. What if I want to split the lines using points? – Wanjohi254 Mar 29 '17 at 13:08
  • @Wanjohi254 You're welcome. If this hint solved your issue, I will post it as an answer for helping potential future readers. – mgri Mar 29 '17 at 13:10

You may use the Split lines with lines algorithm available from the Processing Toolbox: its name is self-explanatory and I think it will solve your issue when dealing with lines.

For other kinds of geometries, I think the best would be to ask a separate question for each one because, otherwise, the topic would become too broad since every geometry type needs a different approach.

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.