If large buildings stand close to the street, the default method of running the building connection lines from the street to the centroid of the building polygon can lead to much too long connection lines.
In the attached PR (commit c1870cb7894def12b901483b943a02b1ea108b5d), I propose a new method='boundary' for the functions process_geometry() and create_points_from_polygons().
In one case of mine the house connections lines are now only 60% of the previous total length.
The 'midpoint' method (using the centroid) must already have been run, generating the default connection lines from street to centroid. Then the following rules apply:
If there is only one intersection between that line and the boundary of the building, this intersection point is used as the connection point instead (and the connection line is shortened accordingly).
However, complex building shapes can produce multiple intersections. In this case, the intersection with the 'convex hull' of the building is used instead. This may result in connection points that do not touch an actual building wall, but it should still be an improvement compared to the 'midpoint' method.
In case of no intersections with the building boundary (possible for e.g. U-shaped buildings), the original centroid is used.
All of these conditions appear in the attached plots. For reference, they also show the convex hull.
The placement of the code within process_geometry() may not be the most elegant, because it depends on the midpoint method and create_object_connections() having already run. But I guess it is efficient.
If large buildings stand close to the street, the default method of running the building connection lines from the street to the centroid of the building polygon can lead to much too long connection lines.
In the attached PR (commit c1870cb7894def12b901483b943a02b1ea108b5d), I propose a new method='boundary' for the functions
process_geometry()
andcreate_points_from_polygons()
. In one case of mine the house connections lines are now only 60% of the previous total length.The 'midpoint' method (using the centroid) must already have been run, generating the default connection lines from street to centroid. Then the following rules apply:
All of these conditions appear in the attached plots. For reference, they also show the convex hull.
The placement of the code within
process_geometry()
may not be the most elegant, because it depends on the midpoint method andcreate_object_connections()
having already run. But I guess it is efficient.