-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
166 lines (124 loc) · 6.4 KB
/
app.py
File metadata and controls
166 lines (124 loc) · 6.4 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
"""
Command line interface - interactive.
"""
import sys
import os
from cmd import Cmd
from FastIsochrone.convex_hull_isochrones import ConvexHullIsochrones
from FastIsochrone.detailed_isochrones import DetailedIsochrones
from FastIsochrone.buffer_isochrones import BufferIsochrones
from FastIsochrone.config import PROJECT_DIR, networkType, tripTimes, travelSpeed, epsgCode, networkDistance
class CLI(Cmd):
intro = """
███████╗░█████╗░░██████╗████████╗██╗░██████╗░█████╗░░█████╗░██╗░░██╗██████╗░░█████╗░███╗░░██╗███████╗
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██║██╔════╝██╔══██╗██╔══██╗██║░░██║██╔══██╗██╔══██╗████╗░██║██╔════╝
█████╗░░███████║╚█████╗░░░░██║░░░██║╚█████╗░██║░░██║██║░░╚═╝███████║██████╔╝██║░░██║██╔██╗██║█████╗░░
██╔══╝░░██╔══██║░╚═══██╗░░░██║░░░██║░╚═══██╗██║░░██║██║░░██╗██╔══██║██╔══██╗██║░░██║██║╚████║██╔══╝░░
██║░░░░░██║░░██║██████╔╝░░░██║░░░██║██████╔╝╚█████╔╝╚█████╔╝██║░░██║██║░░██║╚█████╔╝██║░╚███║███████╗
╚═╝░░░░░╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░╚═╝╚═════╝░░╚════╝░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░╚═╝░░╚══╝╚══════╝
Welcome to FastIsochrone 0.2.2
Creator's homepage: https://jpacoch.github.io
Help is availible with the command: help
When ready to quit, enter: quit
Type ? to list commands."""
prompt = 'FastIsochrone 0.2.2> '
def do_create_convexhull_iso(self, empty_args):
"""
Create simple convex hull isochrones for given points and export to ESRI Shapefile.
Arguments to use:
No arguments required.
Usage:
Enter command: do_create_convexhull_iso
Result: Convex hull isochrones are made from ESRI Shapefile input file with point layer.
Optional actions:
- Plotting single convex hull isochrone (y/n)
- Plotting single point isochrone (y/n)
- Naming the export files.
"""
x = ConvexHullIsochrones(networkType, tripTimes, travelSpeed, epsgCode, networkDistance)
x.createConvexHullIsochrones()
print('Would you like to plot single convex hull isochrone?')
print('y/n')
q1 = input()
if q1 == 'y':
x.plotConvexHullIsochrone()
print('Would you like to plot single point isochrone?')
print('y/n')
q2 = input()
if q2 == 'y':
x.plotPointIsochrone()
print('Enter export file name:')
filename = input()
x.export(filename=filename)
def do_create_detailed_iso(self, empty_args):
"""
Create detailed isochrones fitted to the network for given points and export to ESRI Shapefile.
Arguments to use:
No arguments required.
Usage:
Enter command: do_create_detailed_iso
Result: Detailed isochrones are made from ESRI Shapefile input file with point layer.
Optional actions:
- Plotting single detailed isochrone (y/n)
- Plotting single point isochrone (y/n)
- Naming the export files.
"""
y = DetailedIsochrones(networkType, tripTimes, travelSpeed, epsgCode, networkDistance)
y.createDetailedIsochrones()
print('Would you like to plot detailed isochrone?')
print('y/n')
q1 = input()
if q1 == 'y':
y.plotDetailedIsochrone()
print('Would you like to plot single point isochrone?')
print('y/n')
q2 = input()
if q2 == 'y':
y.plotPointIsochrone()
print('Enter export file name:')
filename = input()
y.export(filename=filename)
def do_create_buffer_iso(self, empty_args):
"""
Create buffers that create simple isochrones along the network and export to ESRI Shapefile.
Arguments to use:
No arguments required.
Usage:
Enter command: do_create_buffer_iso
Result: Buffer isochrones are made from ESRI Shapefile input file with point layer.
Optional actions:
- Plotting single buffer isochrone (y/n)
- Plotting single point isochrone (y/n)
- Naming the export files.
"""
print('Please provide a value of edge buffer:')
edgeBuffer = int(input())
print('Please provide a value of node buffer:')
nodeBuffer = int(input())
y = BufferIsochrones(networkType, tripTimes, travelSpeed, epsgCode, networkDistance, edgeBuffer, nodeBuffer)
y.createBufferIsochrones()
print('Would you like to plot single buffer isochrone?')
print('y/n')
q1 = input()
if q1 == 'y':
y.plotBufferIsochrone()
print('Would you like to plot single point isochrone?')
print('y/n')
q2 = input()
if q2 == 'y':
y.plotPointIsochrone()
print('Enter export file name:')
filename = input()
y.export(filename=filename)
def do_quit(self, empty_args):
"""
Quit the command line interface.
Arguments to use:
No arguments required.
Usage:
Enter command: quit
Result: Quit the command line interface.
"""
sys.exit()
if __name__ == '__main__':
CLI().cmdloop()