add option for map theme

This commit is contained in:
KF7EEL 2021-02-28 17:27:08 -08:00
parent 7febe66a76
commit 89176e922c
4 changed files with 7 additions and 4 deletions

View File

@ -167,7 +167,7 @@ def dashboard_loc_write(call, lat, lon, time):
# dash_entries = [] # dash_entries = []
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time}) dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time})
with open("/tmp/gps_data_user_loc.txt", 'w') as user_loc_file: with open("/tmp/gps_data_user_loc.txt", 'w') as user_loc_file:
user_loc_file.write(str(dash_entries[:50])) user_loc_file.write(str(dash_entries[:200]))
user_loc_file.close() user_loc_file.close()
logger.info('User location saved for dashboard') logger.info('User location saved for dashboard')
#logger.info(dash_entries) #logger.info(dash_entries)

View File

@ -160,7 +160,7 @@ def dashboard_loc_write(call, lat, lon, time):
# dash_entries = [] # dash_entries = []
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time}) dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time})
with open("/tmp/gps_data_user_loc.txt", 'w') as user_loc_file: with open("/tmp/gps_data_user_loc.txt", 'w') as user_loc_file:
user_loc_file.write(str(dash_entries[:50])) user_loc_file.write(str(dash_entries[:200]))
user_loc_file.close() user_loc_file.close()
logger.info('User location saved for dashboard') logger.info('User location saved for dashboard')
#logger.info(dash_entries) #logger.info(dash_entries)

View File

@ -196,7 +196,7 @@ def view_map():
if 'W' in user_coord['lon']: if 'W' in user_coord['lon']:
user_lon = -user_lon user_lon = -user_lon
if user_coord['call'] not in last_known_list and user_coord['call'] == track_call: if user_coord['call'] not in last_known_list and user_coord['call'] == track_call:
folium_map = folium.Map(location=[user_lat, user_lon], tiles="Stamen Toner", zoom_start=15) folium_map = folium.Map(location=[user_lat, user_lon], tiles=map_theme, zoom_start=15)
marker_cluster = MarkerCluster().add_to(folium_map) marker_cluster = MarkerCluster().add_to(folium_map)
folium.Marker([user_lat, user_lon], popup="""<i> folium.Marker([user_lat, user_lon], popup="""<i>
<table style="width: 150px;"> <table style="width: 150px;">
@ -251,7 +251,7 @@ def view_map():
<p style="text-align: center;"><button onclick="self.close()">Close Window</button> <p style="text-align: center;"><button onclick="self.close()">Close Window</button>
</p>""" </p>"""
if not track_call: if not track_call:
folium_map = folium.Map(location=map_center, tiles="Stamen Toner", zoom_start=int(zoom_level)) folium_map = folium.Map(location=map_center, tiles=map_theme, zoom_start=int(zoom_level))
marker_cluster = MarkerCluster().add_to(folium_map) marker_cluster = MarkerCluster().add_to(folium_map)
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'])))

View File

@ -51,6 +51,9 @@ contact_website = 'https://hbl.ink'
# Center dashboard map over these coordinates # Center dashboard map over these coordinates
map_center = (47.00, -120.00) map_center = (47.00, -120.00)
zoom_level = 7 zoom_level = 7
# List and preview of some map themes at http://leaflet-extras.github.io/leaflet-providers/preview/
# The following are options for map themes and just work, you should use one of these: “OpenStreetMap”, “Stamen” (Terrain, Toner, and Watercolor),
map_theme = 'Stamen Toner'
# RSS feed link, shows in the link section of each RSS item. # RSS feed link, shows in the link section of each RSS item.
rss_link = 'http://localhost:8092' rss_link = 'http://localhost:8092'