improve map

This commit is contained in:
KF7EEL 2021-02-26 21:05:18 -08:00
parent ab16d54971
commit 4f3ea5db20
4 changed files with 19 additions and 4 deletions

View File

@ -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="<i>" + str(user_coord['call']) + "</i>", 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)

View File

@ -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

View File

@ -5,6 +5,7 @@
<tbody>
<tr>
<td style="text-align: center;"><button onclick="window.location.href='/';"> D-APRS Dashboard </button></td>
<td style="text-align: center;"><button onclick="window.location.href='/map';"> Station Map </button></td>
<td style="text-align: center;"><button onclick="window.location.href='/help';"> D-APRS Help </button></td>
<td style="text-align: center;"><button onclick="window.location.href='/about';"> Gateway Contact </button></td>
</tr>

View File

@ -0,0 +1,7 @@
{% include 'page.html' %}
{% include 'header.html' %}
{{description}}
<div><p align="center"><iframe style="border: none;" title="Map" src="../view_map" width="900" height="800"></iframe></p></div>
<p>&nbsp;</p>
{% include 'footer.html' %}