SEforALL-IEAP / OMG

Quick techno-economic analysis of potential mini-grid sites. The script is based on OnSSET model with modifications to accommodate specifications related to the overall viability of mini-grids.
0 stars 0 forks source link

GeometryTypeError: Splitting GeometryCollection geometry is not supported in simplify_trunk_lines function #12

Closed julcan7 closed 1 month ago

julcan7 commented 2 months ago

An error occurs when attempting to run the simplify_trunk_lines function in the dist_funcs.py script. The function raises a GeometryTypeError, indicating that splitting a GeometryCollection is not supported.

This errors appears when the following conditions is not met: “if not -1 in region and len(region) > 0:” (Line 147 in the script dist_funcs.py), due that all of the regions from the voronoi regions contains a -1 in each one of the lists, causing that the voronoi_polygons geometry is empty, thus, causing that there are not trunk lines.

Issue_for_GitHub_No_2

julcan7 commented 2 months ago

A screenshot of the issue: Screenshot 2024-08-30 155554

julcan7 commented 1 month ago

The Voronoi package returns a mix of bounded and unbounded regions. In the identified issue, certain combinations of geometries resulted in no trunk line being created because all of the returned regions were unbounded. This issue was resolved by adding an extra step in the simplify_trunk_lines function, which generates additional boundary points around the bounding box of the geometries, using a padding equal to 10% of the largest dimension of the box

In the picture below, the figure on the left illustrates how all regions for the given geometry are unbounded. By adding padding points around the original geometry and appending them to the points generated around the polygon, the regions are forced to converge, resulting in bounded regions, as shown in the figure on the right. Unbounded + Bounded