Skip to content

Instantly share code, notes, and snippets.

@whistler
Created April 6, 2018 02:47
Show Gist options
  • Select an option

  • Save whistler/696968ae70449f7a708a1aa76794f304 to your computer and use it in GitHub Desktop.

Select an option

Save whistler/696968ae70449f7a708a1aa76794f304 to your computer and use it in GitHub Desktop.

Revisions

  1. Ibrahim Muhammad created this gist Apr 6, 2018.
    9 changes: 9 additions & 0 deletions merge_aois.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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