Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- from os.path import exists
- import simplejson as json
- script, in_file, out_file = argv
- data = json.load(open(in_file))
- geojson = {
- "type": "FeatureCollection",
- "features": [
- {
- "type": "Feature",
- "geometry" : {
- "type": "Point",
- "coordinates": [d["lon"], d["lat"]],
- },
- "properties" : d,
- } for d in data]
- }
- output = open(out_file, 'w')
- json.dump(geojson, output)
- print geojson
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement