Skip to content

Instantly share code, notes, and snippets.

@sverhoeven
Created May 13, 2014 10:36
Show Gist options
  • Save sverhoeven/0dccaca0ea29e0ee58b0 to your computer and use it in GitHub Desktop.
Save sverhoeven/0dccaca0ea29e0ee58b0 to your computer and use it in GitHub Desktop.
Script to convert route around nemo to around nakko
#!/bin/env python
import csv
nemo = {'lat': 52.374253,'lon': 4.911687}
nakko = {'lat':52.330797,'lon':4.966013}
with open('in.csv', 'rb') as csvin:
with open('out.csv', 'wb') as csvout:
reader = csv.reader(csvin)
writer = csv.writer(csvout)
for row in reader:
if (len(row) < 3):
pass
elif row[0] == 'ts':
writer.writerow(row)
else:
row[1] = float(row[1]) - (nemo['lon'] - nakko['lon'])
row[2] = float(row[2]) - (nemo['lat'] - nakko['lat'])
writer.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment