Skip to content

Instantly share code, notes, and snippets.

@JimHaughwout
Last active April 2, 2016 19:29
Show Gist options
  • Save JimHaughwout/1b3375a17ade17c1d4ce3d0b01754dfc to your computer and use it in GitHub Desktop.
Save JimHaughwout/1b3375a17ade17c1d4ce3d0b01754dfc to your computer and use it in GitHub Desktop.
Display GeoJSON on http://geojson.io via command line
#!/usr/bin/python
import json
from sys import argv, exit
from geojsonio import display
CMD_NAME = argv[0]
HELP_TEXT = """
%s - Displays GeoJSON FeatureCollection or Geometry object via http://geojson.io
Usage:
%s <geojsonFileName>
""" % (CMD_NAME, CMD_NAME)
if len(argv) != 2:
print HELP_TEXT
exit(9)
SOURCE = argv[1]
with open(SOURCE, 'r') as fle:
data_dict = json.load(fle)
data_as_json = json.dumps(data_dict)
display(data_as_json)
@JimHaughwout
Copy link
Author

No idea why this keeps making tabs 8 spaces 🎱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment