improve map
This commit is contained in:
parent
ab16d54971
commit
4f3ea5db20
|
@ -131,11 +131,11 @@ def help():
|
||||||
def about():
|
def about():
|
||||||
#return get_data()
|
#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)
|
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/')
|
@app.route('/view_map/')
|
||||||
def map():
|
def view_map():
|
||||||
user_loc = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
user_loc = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
||||||
map_center = (47.9540700, -120.7360300)
|
#map_center = (47.9540700, -120.7360300)
|
||||||
folium_map = folium.Map(location=map_center, zoom_start=14)
|
folium_map = folium.Map(location=map_center, zoom_start=int(zoom_level))
|
||||||
for user_coord in user_loc:
|
for user_coord in user_loc:
|
||||||
user_lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lat'])))
|
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'])))
|
user_lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lon'])))
|
||||||
|
@ -145,6 +145,9 @@ def map():
|
||||||
user_lon = -user_lon
|
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)
|
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_()
|
return folium_map._repr_html_()
|
||||||
|
@app.route('/map/')
|
||||||
|
def map():
|
||||||
|
return render_template('map.html', title = dashboard_title, logo = logo)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug = True, port=dash_port, host=dash_host)
|
app.run(debug = True, port=dash_port, host=dash_host)
|
||||||
|
|
|
@ -47,3 +47,7 @@ contact_name = 'your name'
|
||||||
contact_call = 'N0CALL'
|
contact_call = 'N0CALL'
|
||||||
contact_email = 'email@example.org'
|
contact_email = 'email@example.org'
|
||||||
contact_website = 'https://hbl.ink'
|
contact_website = 'https://hbl.ink'
|
||||||
|
|
||||||
|
# Center dashboard map over these coordinates
|
||||||
|
map_center = (47.00, -120.00)
|
||||||
|
zoom_level = 7
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<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='/';"> 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='/help';"> D-APRS Help </button></td>
|
||||||
<td style="text-align: center;"><button onclick="window.location.href='/about';"> Gateway Contact </button></td>
|
<td style="text-align: center;"><button onclick="window.location.href='/about';"> Gateway Contact </button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -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> </p>
|
||||||
|
{% include 'footer.html' %}
|
||||||
|
|
Loading…
Reference in New Issue