cartagen.random_displacement

cartagen.random_displacement#

random_displacement(polygons, networks=None, polygon_distance=10.0, network_distance=10.0, max_trials=25, max_displacement=10.0, network_partitioning=None)#

Iteratively displace polygons overlapping each other and the provided network.

Displace the provided buildings if they overlap each other or are closer than the width value to the provided networks. This method is not deterministic, at each iteration, the algorithm select a random angle and a random distance to displace the polygon and see if it improves the overlapping issues. Running twice the algorithm returns two different solutions. This algorithm is succinctly presented in Wabiński et al. [1]

Parameters:
  • polygons (GeoDataFrame of Polygon) – The buildings to displace.

  • networks (list of GeoDataFrame of LineString, optional) – A list of networks the polygons need to be moved away from. If left to None, polygons will only be moved away from each other.

  • polygon_distance (float, optional) – The minimum acceptable distance between polygons.

  • network_distance (float, optional) – The minimum acceptable distance between the polygons and the provided networks.

  • max_trials (int, optional) – The maximum number of trials before stopping the iteration. A trial represent the movement of one polygon that did not lower the mean overlapping area between polygons and networks.

  • max_displacement (float, optional) – The maximum allowed distance of displacement per iteration.

  • network_partioning (GeoDataFrame of LineString, optional) – The network to partition the data with. If provided, each network face is treated individually, thus improving performance on larger dataset.

Returns:

GeoDataFrame

See also

network_faces

Calculates the faces of one or multiple networks.

References

(Source code)

../_images/random_displacement.png