Skip to content

Instantly share code, notes, and snippets.

@olafveerman
Created October 8, 2015 16:40
Show Gist options
  • Save olafveerman/e5a47832a8ddd6731678 to your computer and use it in GitHub Desktop.
Save olafveerman/e5a47832a8ddd6731678 to your computer and use it in GitHub Desktop.
Reads a geojson and removes all properties except for 'name'
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