Last active
April 2, 2016 19:29
-
-
Save JimHaughwout/1b3375a17ade17c1d4ce3d0b01754dfc to your computer and use it in GitHub Desktop.
Display GeoJSON on http://geojson.io via command line
This file contains hidden or 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/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No idea why this keeps making tabs 8 spaces 🎱