Created
October 8, 2015 16:40
-
-
Save olafveerman/e5a47832a8ddd6731678 to your computer and use it in GitHub Desktop.
Reads a geojson and removes all properties except for 'name'
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
import json | |
with open('./parksway.geojson','rb') as f: | |
reader = json.load(f) | |
for ft in reader["features"]: | |
for p in ft["properties"].keys(): | |
if not p == 'name': | |
del ft["properties"][p] | |
with open('./parkways-trimmed.geosjon','w') as of: | |
json.dump(reader, of) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment