Created
February 6, 2016 12:56
-
-
Save craigloftus/e2772d4ead313b45ebdd to your computer and use it in GitHub Desktop.
Simple script to count bicycle parking capacity from overpass data
This file contains 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
#!/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