I have this selected rectangular polygon in yellow on a layer with hundreds of polygons:
I need to split the selected polygon in 4 vertical columns (Y axis) and 8 horizontal rows (X axis), so that I get 32 final same-sized polygons. Something like this should be the output:
I have tested these plugins with no success so far:
- Polygon Divider
- Polygon Splitter
- Split Polygon
- Split Features on steroids
EDITED 19.12.2018:
Well in fact I have a layer with hundreds of polygons. It is my town's graveyard and it is divided in zones:
I need to split some of them in smaller tiles (real graves, pantheons, etc) so that I can locate each buried person in his parcel (tile).
In the above image I showed three zones.
Polygon 1: has to be split in 1(columns)x 40(rows) so there would be finally 40 polygons (graves).
Polygon 2: has to be split in 2(columns)x 50(rows) so there would be finally 100 polygons (graves).
Polygon 3: has to be split in 2(columns)x 3(rows) so there would be finally 6 polygons (graves).
All the polygons that need to be split have square-rectangle shape; only 4 sides.
EDIT 20.12.2018:
Array of offset (parallel) lines tool is not working well in my case. Seems that rectangles are not perfect (horizontal sides do not have exact same length, same with vertical). See image below:
Best Answer
I went through a relatively convoluted way of doing it without having to script anything in Python or without having to resort to plugins. It's still semi-manual and includes some nested expressions but it works. Bear in mind this was done in QGIS 3.4. Some features used might not be available in earlier versions. To further automate the process, it could be made into a processing model.
First off, this method takes a few things for granted:
The original data I used looks like this:
From there, a sequence of tools can be used to go from the original zones to subdivided plots (every tool takes as input layer the output of the previous tool):
Using the Extract by expression tool, get only the two first segments of a rectangle with this expression (it tests for an array of only first and second segments of exploded sides):
Using the Field calculator tool, create a new field (in my case called
len_seg
) of typefloat
where$length
is calculatedUsing the Array of offset (parallel) lines tool, create the plot subdivision lines with these expressions in the relevant parameters (it's convenient that the segments' right side is always inside the original polygon. I had to round the segment lengths before evaluating them as it seems there might be slight differences between opposite sides even for 'perfect' rectangles):
Number of features to create:
Offset step distance:
0.02
in my example) to the plot lines. This ensures angled rectangles have complete polygon rings for the last step.The result looks like this: