seattlecitylight-mastodon-bot/geospatial.py

12 lines
385 B
Python
Raw Normal View History

2024-04-20 14:04:20 -07:00
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)