Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created August 19, 2018 14:47
Show Gist options
  • Save joaofig/216f04728d05a57e1ba2ed1653200aaa to your computer and use it in GitHub Desktop.
Save joaofig/216f04728d05a57e1ba2ed1653200aaa to your computer and use it in GitHub Desktop.
Create DBSCAN bubbles
# Create the list of cluster blobs
from shapely.ops import cascaded_union
clusters = list()
blobs = list()
counts = list()
for cluster_id, points in groups:
if cluster_id >= 0:
buffer_radius = eps_in_meters * 0.6
buffers = [buffer_in_meters(lon, lat, buffer_radius) for lon, lat in zip(points['Longitude'], points['Latitude'])]
blob = cascaded_union(buffers)
blobs.append(blob)
clusters.append(cluster_id)
counts.append(len(points))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment