Created
April 6, 2018 02:47
-
-
Save whistler/696968ae70449f7a708a1aa76794f304 to your computer and use it in GitHub Desktop.
Merge two GeoJSON AOIs into one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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