Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Merge two GeoJSON AOIs into one
from functools import reduce
import shapely.geometry
import geojson
def merge_aois(aois):
shapes = (shapely.geometry.asShape(aoi) for aoi in aois)
union = reduce(lambda a, b: a.union(b), shapes)
merged_aoi = geojson.Feature(geometry=union, properties={})
return merged_aoi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.