Skip to content

jonnyhuck/RFCL-PolygonDivider

Repository files navigation

icon Polygon Divider QGIS Plugin

Now available for QGIS 3 (QGIS2 version available in this branch)

Polygon Divider is a plugin for QGIS that takes a polygon and efficiently divides it into a number of 'squareish' polygons of a defined size, which is useful for a multitude of applications such as land parceling, environmental sampling, and so on.

As a simple worked example, you can take a polygon like this:

hull

...and divide it into a number of smaller 'squareish' polygons of about 1000m2 (it would be exactly 1000m2 if the polygon happened to have an area that precisely divides by 1000):

divided hull

There are two options available to the user when dividing a polygon. The above uses the absorb method, whereby all of the polygons are slightly larger than the requested size, in order to 'absorb' any odd-sized 'offcuts' that would otherwise be left behind. The other alternative would be the offcut method. An example of this is given below, in which all of the polygons would be the precise size as requested, except for the light green one at the very top, which represente the 'offcut':

offcut hull

The choice of which is best from the above will vary depending upon the specific requirements of the user, and the simplicity of the polygon in question.

Each of the above cutting methods can be undertaken in 4 directions: left-right, right-left, bottom-top and top-bottom. Again, depending upon the shape of the specific polygon to be divided, better results might be achieved in some directions than others.

Each output polygon inherits all of the attributes from its parent, as well as the following additional attributes:

  • ps_id: a unique integer ID for each output polygon
  • ps_uuid: a version 4 uuid
  • ps_area: the area of the polygon
  • ps_repPointX: the X coordinate of a point guaranteed to be within the resulting polygon (not necessarily the geometric centroid, as this is not gurranteed to be within the resulting polygon)
  • ps_repPointY: the Y coordinate of a point guaranteed to be within the resulting polygon (not necessarily the geometric centroid, as this is not gurranteed to be within the resulting polygon)

The software should work well on some quite complex polygons:

complex division example 1

...even if they are very large:

complex division example 1

In cases where the algorithm finds the geometry difficult to divide, it will make the polygons slightly less square and more rectangular (as is illustrated in both of the above examples). If you find that it doesn't manage to divide a certain geometry at all, then you can normally remedy this by simplifying it a little.

Please do get in touch with a copy of any polygons that do not work, they will help us continue to improve this plugin!

Data Considerations:

The Polygon Divider expects planar geometry (x,y coordinates) and will not divide geographical coordinates (degrees). If you are using geographical coordinates you must save your dataset using a Projected Coordinate System (It is recommended that you use either a local or equal area projection). Note that while QGIS will allow you to change the CRS for the project/layer, doing so is not enough as it does not save the data and only reprojects the view for the user.

Acknowledgements:

The QGIS2 (original) version of this plugin was funded by Zero Waste Scotland Ltd.. The conversion to QGIS3 was funded by Deutsche Forestservice GMBH.

Development was greatly assisted by the accepted answer to this forum post and the pyroots implementation of Brent's method.

About

QGIS Plugin for dividing polygons

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •