Fix center of outage calculation (#24)
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed

Solves #23

Reviewed-on: #24
This commit is contained in:
Liam Steckler 2024-04-20 15:03:16 -07:00
parent 8b54a4b78c
commit 4accc75c06
4 changed files with 54 additions and 20 deletions

11
geospatial.py Normal file
View file

@ -0,0 +1,11 @@
from shapely import MultiPolygon, Polygon
def convert_outage_geometry(event) -> MultiPolygon:
assert event["polygons"]["type"] == "polygon"
assert event["polygons"]["hasZ"] is False
assert event["polygons"]["hasM"] is False
polygon_list = []
for ring in event["polygons"]["rings"]:
polygon_list.append(Polygon(ring))
return MultiPolygon(polygon_list)