Skip to content

Instantly share code, notes, and snippets.

@jqtrde
Created February 4, 2016 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jqtrde/02eeaf336d9496e0b1ab to your computer and use it in GitHub Desktop.
Save jqtrde/02eeaf336d9496e0b1ab to your computer and use it in GitHub Desktop.
from collections import OrderedDict
import click
import json
import tgf
@click.command('tgf')
@click.argument('input', default='-', required=False)
def cli(input):
try:
input = click.open_file(input).readlines()
except IOError:
input = [input]
click.echo(json.dumps(OrderedDict([
('type', 'FeatureCollection'),
('features', [json.loads(f) for f in input])
])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment