From 4f3ea5db2019770578910d2c9fe76881311b2053 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Fri, 26 Feb 2021 21:05:18 -0800 Subject: [PATCH] improve map --- scripts/dashboard/dashboard.py | 11 +++++++---- scripts/dashboard/dashboard_settings-SAMPLE.py | 4 ++++ scripts/dashboard/templates/header.html | 1 + scripts/dashboard/templates/map.html | 7 +++++++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 scripts/dashboard/templates/map.html diff --git a/scripts/dashboard/dashboard.py b/scripts/dashboard/dashboard.py index c453617..4212ca8 100644 --- a/scripts/dashboard/dashboard.py +++ b/scripts/dashboard/dashboard.py @@ -131,11 +131,11 @@ def help(): def about(): #return get_data() return render_template('about.html', title = dashboard_title, logo = logo, contact_name = contact_name, contact_call = contact_call, contact_email = contact_email, contact_website = contact_website) -@app.route('/map/') -def map(): +@app.route('/view_map/') +def view_map(): user_loc = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read()) - map_center = (47.9540700, -120.7360300) - folium_map = folium.Map(location=map_center, zoom_start=14) + #map_center = (47.9540700, -120.7360300) + folium_map = folium.Map(location=map_center, zoom_start=int(zoom_level)) for user_coord in user_loc: user_lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lat']))) user_lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lon']))) @@ -145,6 +145,9 @@ def map(): user_lon = -user_lon folium.Marker([user_lat, user_lon], popup="" + str(user_coord['call']) + "", tooltip=str(user_coord['call'])).add_to(folium_map) return folium_map._repr_html_() +@app.route('/map/') +def map(): + return render_template('map.html', title = dashboard_title, logo = logo) if __name__ == '__main__': app.run(debug = True, port=dash_port, host=dash_host) diff --git a/scripts/dashboard/dashboard_settings-SAMPLE.py b/scripts/dashboard/dashboard_settings-SAMPLE.py index 1eb2b6b..1c36c8e 100644 --- a/scripts/dashboard/dashboard_settings-SAMPLE.py +++ b/scripts/dashboard/dashboard_settings-SAMPLE.py @@ -47,3 +47,7 @@ contact_name = 'your name' contact_call = 'N0CALL' contact_email = 'email@example.org' contact_website = 'https://hbl.ink' + +# Center dashboard map over these coordinates +map_center = (47.00, -120.00) +zoom_level = 7 diff --git a/scripts/dashboard/templates/header.html b/scripts/dashboard/templates/header.html index f76936a..0913a88 100644 --- a/scripts/dashboard/templates/header.html +++ b/scripts/dashboard/templates/header.html @@ -5,6 +5,7 @@ + diff --git a/scripts/dashboard/templates/map.html b/scripts/dashboard/templates/map.html new file mode 100644 index 0000000..0c5bdae --- /dev/null +++ b/scripts/dashboard/templates/map.html @@ -0,0 +1,7 @@ +{% include 'page.html' %} +{% include 'header.html' %} +{{description}} +

+

 

+{% include 'footer.html' %} +