Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created February 4, 2015 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/f7d335167373fc0dc464 to your computer and use it in GitHub Desktop.
Save tmcw/f7d335167373fc0dc464 to your computer and use it in GitHub Desktop.
import pprint
import json
import rasterio
from shapely.geometry import Polygon
from rasterio import features
from shapely.ops import cascaded_union
with rasterio.open('logo-bw.png') as src:
blue = src.read_band(3)
mask = blue < 10
shapes = features.shapes(blue, mask=mask)
geojson = { "type": "FeatureCollection", "features": [] }
polygons = []
for shape in shapes:
p = Polygon(shape[0]['coordinates'][0])
polygons.append(p)
mega = cascaded_union(polygons)
@tmcw
Copy link
Author

tmcw commented Feb 4, 2015

Output:

~/src/presentations/turf-geodc/code〉python vectorize-merge.py
Assertion failed: (!"should never be reached"), function itemsTree, file AbstractSTRtree.cpp, line 371.
zsh: abort      python vectorize-merge.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment