Skip to content

Instantly share code, notes, and snippets.

Last active Dec 30, 2015
What would you like to do?
Example of RFC 6902 GeoJSON diff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
import jsonpatch
import os.path
import requests
import subprocess
# original
if not os.path.exists('hackspots-44de76ef53.json'):
r = requests.get('')
data = r.content
with open('hackspots-44de76ef53.json', 'wb') as f:
# next commit
if not os.path.exists('hackspots-e9514f5c31.json'):
r = requests.get('')
data = r.content
with open('hackspots-e9514f5c31.json', 'wb') as f:
diff_text = subprocess.check_output([
diff = json.loads(diff_text)
print(json.dumps(diff, indent=2))
# Moving coordinates of hackspots-e9514f5c31
diff = '[{"path": "/features/2/geometry/coordinates/0", "value": -122.655, "op": "replace"}, {"path": "/features/2/geometry/coordinates/1", "value": 45.522, "op": "replace"}]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment