I'm working on a project using QGIS and there is a process that I'd like to try to automate.
I'm working with the "rectangles,ovals digitizing tool" plug-in to make perfect rectangles. The next step in my process is to split these rectangles horizontally and vertically in equal intervals in order to make many smaller equal-area rectangles as shown in the picture below.
I am currently using a help line layer and the plug-in "qchainage" to split the lines equally across each side of the rectangle. Then I use snapping to cut the polygon where the vertices's were created.
This process isn't bad, but it's getting too slow and opens a door for manual mistakes.
I'd like to find or develop a plug-in or a script, where I can input a selected rectangle, an integer m for the number of parts I want to split the short side to and another integer n for the number of parts I want to split the long side to. In the example above – m = 2 , n = 5 .
I've tried to learn from this discussion, but didn't find what I was looking for. I've written a few scripts using pyqgis so if anyone has a suggestion I can try to implement it.
Best Answer
You could try using the Polygon Divider plugin which allows you to divide your polygons to a specified size. You can download this from the menubar:
Example:
A rectangle with an area ~100,000 m2:
Executing the plugin to create 'parts', each with an area of 10,000 m2:
You could also check the source code for the plugin to see how it's done and use the code for your own scripts or modify the plugin itself.