Skip to content

Commit ec27903

Browse files
authored
Merge pull request #93 from datakind/Zebreu-patch-colors
Update visualization.py
2 parents ace2dc1 + 249b907 commit ec27903

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

dkroutingtool/src/py/server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ def download(session_id: str=''):
154154

155155
@app.get('/request_map/')
156156
def request_map(minlat, minlon, maxlat, maxlon):
157-
stateful_info['bounding_box'] = [minlat, minlon, maxlat, maxlon]
158-
159157
request_template = f'''
160158
[out:xml]
161159
[bbox:{minlon},{minlat}, {maxlon}, {maxlat}];
@@ -171,6 +169,7 @@ def request_map(minlat, minlon, maxlat, maxlon):
171169
opened.write(r.text)
172170
os.environ['osm_filename'] = 'ui_map'
173171
temporary_build_profiles()
172+
stateful_info['bounding_box'] = [minlat, minlon, maxlat, maxlon]
174173
return {'message': 'Done'}
175174

176175

@@ -220,4 +219,4 @@ def temporary_build_profiles(osmpbf=False):
220219

221220

222221
if __name__ == '__main__':
223-
uvicorn.run(app, host='0.0.0.0', port=5001)
222+
uvicorn.run(app, host='0.0.0.0', port=5001)

dkroutingtool/src/py/ui/dashboard.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323
#TODO Need to make sure you can retrieve original solution state even if manual adjustments were requested?
2424

25-
colors_hex = ["#FF0000", "#00FF00", "#0000FF", "#FF00FF", "#00FFFF", "#FF8000", "#800080", "#008000", "#800000", "#008080", "#808000", "#4682B4", "#A0522D", "#000000", "#191970", "#00FF80", "#FF0080", "#80FF00", "#8000FF", "#0080FF", "#E9967A", "#8B008B", "#FFBF00", "#000080", "#FFFF00"]
26-
color_names = ["red", "lime", "blue", "magenta", "cyan", "orange", "purple", "darkgreen", "maroon", "teal", "olive", "steelblue", "sienna", "black", "midnightblue", "springgreen", "rose", "chartreuse", "violet", "dodgerblue", "darksalmon", "darkmagenta", "amber", "navy", "yellow"]
25+
26+
27+
colors_hex = ["#FF0000","#00FF00","#0000FF","#FF00FF","#00FFFF","#FF8000","#800080","#008000","#800000","#008080","#808000","#4682B4","#A0522D","#000000","#191970","#00FF80","#FF0080","#80FF00","#8000FF","#0080FF","#E9967A","#8B008B","#FFBF00","#000080","#FFFF00","#FFFFFF","#808080","#A52A2A","#FFC0CB","#FFD700","#C0C0C0","#4B0082","#D2B48C","#87CEEB","#F0E68C"]
28+
color_names = ["red", "lime", "blue", "magenta", "cyan", "orange", "purple", "darkgreen", "maroon", "teal", "olive", "steelblue", "sienna", "black", "midnightblue", "springgreen", "rose", "chartreuse", "violet", "dodgerblue", "darksalmon", "darkmagenta", "amber", "navy", "yellow", "white","gray","brown","pink","gold","silver","indigo","tan","skyblue","khaki"]
2729
color_map = {k:v for k,v in zip(color_names,colors_hex)}
2830

2931
st.set_page_config(page_title='Container-based Action Routing Tool (CART)', layout="wide")
@@ -744,4 +746,4 @@ def update_data():
744746

745747

746748
if __name__ == '__main__':
747-
main()
749+
main()

dkroutingtool/src/py/visualization.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@
4040
"#E9967A", # darksalmon
4141
"#8B008B", # darkmagenta
4242
"#FFBF00", # amber
43-
"#000080", # navy
44-
"#FFFF00" # yellow
43+
"#000080", # navy
44+
"#FFFF00", # yellow
45+
"#FFFFFF", # white
46+
"#808080", # gray
47+
"#A52A2A", # brown
48+
"#FFC0CB", # pink
49+
"#FFD700", # gold
50+
"#C0C0C0", # silver
51+
"#4B0082", # indigo
52+
"#D2B48C", # tan
53+
"#87CEEB", # skyblue
54+
"#F0E68C", # khaki
4555
]
4656

4757
color_names = [
@@ -69,7 +79,17 @@
6979
"darkmagenta",
7080
"amber",
7181
"navy",
72-
"yellow"
82+
"yellow",
83+
"white",
84+
"gray",
85+
"brown",
86+
"pink",
87+
"gold",
88+
"silver",
89+
"indigo",
90+
"tan",
91+
"skyblue",
92+
"khaki",
7393
]
7494

7595
def folium_map(routes, nodes, manual_editing_mode,
@@ -532,4 +552,4 @@ def create_visualizations(solution: FinalOptimizationSolution,
532552
)
533553
# Create and save a js file containing geojson
534554
# with route geometry
535-
#create_geojson(assignment, routing, data)
555+
#create_geojson(assignment, routing, data)

0 commit comments

Comments
 (0)