Skip to content

Instantly share code, notes, and snippets.

@craigloftus
Created February 6, 2016 12:56
Show Gist options
  • Save craigloftus/e2772d4ead313b45ebdd to your computer and use it in GitHub Desktop.
Save craigloftus/e2772d4ead313b45ebdd to your computer and use it in GitHub Desktop.
Simple script to count bicycle parking capacity from overpass data
#!/usr/bin/env python
import json
geojson = json.load(open('bicycle_parking.geojson', 'r'))
features = geojson['features']
with_capacity = [f for f in features if f['properties'].get('capacity')]
without_capacity = [f for f in features if not f['properties'].get('capacity')]
print("Total:", len(features))
print("With capacity:", len(with_capacity))
print("Without capacity:", len(without_capacity))
total = sum([int(f['properties'].get('capacity')) for f in with_capacity])
print("Total capacity:", total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment