1

I have a line shapefile where the lines form a closed polygon. Using QGIS (2.8 on OSX 10.7) I would like to add lines to the layer, basically splitting the polygon into quadrants. Then, I will need to convert the line shapefile to a polygon shapefile, so that the newly formed quadrants will be separate polygons.

I am encountering some difficulties, and am hoping I can be pointed in the right direction. First, when I add the new lines, they don't "split" the existing boundary lines of the polygon where the new lines intersect (I am snapping the new lines to existing vertices of the boundary lines). Second, where the new lines cross in the middle, they also don't split/intersect.

In order to create a polygon shapefile with the necessary quadrants, it seems that the lines need to be intersected, or else I only get the main original polygon as a result (using the Polygonize process). I have tried the "Split lines with lines" option (using my line shapefile as both the input and output layer), and I have tried v.clean from the GRASS processes, but neither of these approaches split the lines where they intersect (either in the middle, or on the boundary) in all cases, only some.

I feel that the easiest way would be if the new lines would split the existing lines when I add them (and also split each other where they cross), but I can't figure out how to do that.

  • 2
    Generally new feature creation won't affect existing features. There's no way to split a line while creating a new one; they're two separate steps. Two things seem odd to me. First, split lines with lines or v.clean should be working and it's unclear why they wouldn't. Are the two layers in the same coordinate system? Which version of QGIS are you using? The second thing is that, at least with ArcGIS, the lines don't have to be split or even share nodes in order to create polygons - they just have to completely enclose an area. This further indicates something isn't right with the lines. – Chris W May 7 '15 at 20:36
  • Hi Chris. Thank you for your help. I'm using QGIS 2.8 on OSX 10.7. Split lines with lines and v.clean are both partially working. They split the lines at some of the intersections, but not all of them. I can't pinpoint what would be wrong with the lines, as they seem to look fine to me, and are complete segments, without any gaps or dangles. – Wes Kent May 8 '15 at 12:34
  • 1
    Generally you should edit your question to include the details requested in comment, that way people don't have to read through a long chain to get the full picture. Without seeing examples or having he file to test with as Joseph suggested, it's hard to offer suggestion on what might be wrong. First thing I would to is run Check Geometry Validity or whatever it's called. Then I know in v.clean there are certain options/parameters - ie, break lines at all intersections vs only break lines at shared vertices. – Chris W May 8 '15 at 21:32
1

Very good points by @ChrisW. An alternative which may do what you seek is to first polygonize your line shapefile and then create your quadrants (I've included a simple example):

Line shapefile

I then used the Lines to polygons tool:

Lines to polygons

Now you can use the Split features tool (from toolbar, Edit > Split features) which allows you to split your feature (line, polygon etc) into multiple features:

Split features option

You basically left-click to start drawing a line as to where you want the features to be split, left-click again to finish drawing the line and finally right-click to execute the split:

Split features of polygon

Now each of the quadrant is its own feature:

Attributes

Hope this helps!

  • Hi Joseph. Thank you for your suggestion, as this approach did work well for me, and accomplished what I needed. Would the Split features tool allow me to split the line segments in the original shapefile? For example, I selected one of the boundary lines, and then tried to split it at a vertex, but I received a message telling me that no features were split. – Wes Kent May 8 '15 at 12:42
  • @WesKent - Glad it worked buddy! It should split line shapefiles aswell (I just tested it successfully) so I'm not exactly sure why it's not working. Could be perhaps you snapped it beforehand? Would it be possible for you to upload your line shapefile to a public server (eg. Dropbox) so that it can be tested by others? – Joseph May 8 '15 at 12:48
  • 1
    As I was playing around with it some more, I figured out what I was doing wrong. I was expecting that I would just need to click once on the spot where I wanted the line to be split; but then I realized that I had to use the Split features tool to draw a line across/perpendicular to the spot on the original line, where I wanted it split. Once I did that, it worked perfectly! Thanks again for all of your help! – Wes Kent May 8 '15 at 12:58
  • @WesKent - Ahh apologies, I should have explained that part better, my fault! And your most welcome mate :) – Joseph May 8 '15 at 13:00
  • 1
    @WesKent Different tools have different quirks. In ArcGIS there actually is a split line at point tool that requires you only click once (well, twice, the first time being to select the line). Don't know if QGIS has that off the top of my head. Splitting/cutting polygons typically requires you start outside the feature and completely cross it, though you can snap to points/edges/etc on the line in doing so. Basically the tool needs to determine that all of the shape falls on one side of the cutting line or the other. – Chris W May 8 '15 at 21:26

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.