Repository metrics
- Stars
- (351 stars)
- PR merge metrics
- (PR metrics pending)
Description
So I tried this out by starting from the
cluster_network.pyscript. In 28f8500, I introduced a function that maps the network buses to their correct gadm regions (could easily be changed to nuts or any other subdivisions). The end product is correctly mapped clustered nodes, but many open sub issues and bugs remain:* [ ] Decide where to place the shape-representing node, as of now it is located to the mean long & mean lat of all the buses of the shape. Alternatively could be placed at the centroid of the shape? (will probably need modifying PyPSA scripts, namely `networkclustering.py`)
Hi @Hazem-IEG , I just realise that the centroid is sometimes outside of the original shape. This is because the centroid (red) is not equal to the visual centre (green). The probably best way to find the visual centre of shapes is to use the iterative "get_furthest_point_from_edges" algorithm. This is implemented by the Polylabel in shapely. https://stackoverflow.com/questions/1203135/what-is-the-fastest-way-to-find-the-visual-center-of-an-irregularly-shaped-pol

Originally posted by @pz-max in https://github.com/pypsa-meets-africa/pypsa-africa/issues/107#issuecomment-997711362