seattlecitylight-mastodon-bot/geospatial.py

12 lines
385 B
Python
Raw Permalink Normal View History

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)