-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaerovision.py
45 lines (36 loc) · 1.12 KB
/
aerovision.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import sys, getopt
from aerovision.parsers import FlightParser
from aerovision.kml.generators.animation import *
from aerovision.kml.generators.timespan import *
def main(argv):
"""
AeroVision entry point.
"""
# default arguments
flightsFile = "data/flights.csv"
outFile = "output/flights.kml"
visualisation = "animation"
# parse command line arguments
try:
opts, args = getopt.getopt(argv,"hf:o:v:",["flights=","out=","visualisation="])
except getopt.GetoptError:
print('aerovision.py -f <flightsFile> -o <outputfile> -v timespan|animation')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print('aerovision.py -f <flightsFile> -o <outputfile> -v timespan|animation')
sys.exit()
if opt in ('-f', '--flights'):
flightsFile = arg
elif opt in ('-o', '--out'):
outFile = arg
elif opt in ('-v', '--visualisation'):
visualisation = arg
parser = FlightParser()
flights = parser.getFlights(flightsFile)
generator = FlightsKMLAnimation(flights)
if visualisation == 'timespan':
generator = FlightsKMLTimespan(flights)
generator.generateKML(outFile)
if __name__ == "__main__":
main(sys.argv[1:])