[GIS] Considering holes/constraints in Voronoi polygon creation in QGIS

maskingqgisvoronoi-thiessen

I am trying to create voronoi polygons in QGIS that would consider "holes" in the general domain. An example would be:

enter image description here

I actually created the Voronois in this image using QGIS through the GRASS command, then using the "Difference" tool to create the holes. A separate polygon shapefile, which contains the extents of the holes, was used as the "Difference" layer. An example application would be creating polygons around sampling points that were collected between structures that should be excluded from the analysis.

Two problems arise here:

  1. The "difference" function does not appear to work 100% properly, with some polygon boundaries extending into the "holes". This can be fixed by finding row in the Attribute Table which do not have a polygon ID number (or ID of "0").

  2. This type of after-the-fact "hole-punching" can result in discontinuous polygons, as shown by the red arrow in the image.

My question is: is there a Voronoi tool or plugin that can consider the presence of "holes" in the center of the domain, as a one-step process, and also eliminate the generation of discontinuous polygons? I envision that such a tool would extend a polygon boundary to the nearest intersection with another boundary, unless that other boundary slams against a "hole" boundary first.

Best Answer

This might be possible using rasters. First convert your points and boundary polygons into a high resolution raster. Set a mask for your boundaries using r.mask. Then, run r.grow.distance in GRASS and use the Value= output. This will give you for each pixel, which is the closest point. Convert this back into vector polygons. There might be extra steps needed to get rid of sliver polygons.

Related Question