From 716acefb1e5cdbc8815859e20373d86287585899 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Sun, 8 Aug 2021 12:41:35 -0700 Subject: [PATCH] improve map --- hblink.py | 2 +- web/app.py | 74 ++++++++++++++++++++++++++++++++---------- web/templates/map.html | 12 +++---- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/hblink.py b/hblink.py index af96be6..8b20f76 100755 --- a/hblink.py +++ b/hblink.py @@ -678,7 +678,7 @@ class HBSYSTEM(DatagramProtocol): self.send_peer(_peer_id, b''.join([RPTACK, _peer_id])) logger.info('(%s) Peer %s (%s) has sent repeater configuration', self._system, _this_peer['CALLSIGN'], _this_peer['RADIO_ID']) - self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], _this_peer['SOFTWARE_ID']) + self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], str(_this_peer['PACKAGE_ID']) + ' - ' + str(_this_peer['SOFTWARE_ID'])) else: self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) logger.warning('(%s) Peer info from Radio ID that has not logged in: %s', self._system, int_id(_peer_id)) diff --git a/web/app.py b/web/app.py index ce1c81f..95f3405 100644 --- a/web/app.py +++ b/web/app.py @@ -699,24 +699,63 @@ def create_app(): @app.route('/map') @login_required def map_page(): + print(peer_locations) f_map = folium.Map(location=center_map, zoom_start=map_zoom) -## folium.Marker([45.372, -121.6972], popup="hello", icon=folium.Icon(color="red", icon="record"), tooltip='hi').add_to(f_map) for l in peer_locations.items(): +## folium.Marker([float(l[1][1]), float(l[1][2])], popup=''' +##
+##

''' + l[1][0] + '''

+##
+## ''' + l[1][5] + ''' +##
+## ''' + l[1][1] + ''', ''' + l[1][2] + ''' +##
+## ''' + l[1][3] + ''' +##
+## ''' + l[1][4] + ''' +##
+## ''' + l[1][6] + ''' +##
+##
+## ''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l[1][0] + '').add_to(f_map) + folium.Marker([float(l[1][1]), float(l[1][2])], popup=''' -
-

''' + l[1][0] + '''

-
- ''' + l[1][5] + ''' -
- ''' + l[1][1] + ''', ''' + l[1][2] + ''' -
- ''' + l[1][3] + ''' -
- ''' + l[1][4] + ''' -
- ''' + l[1][6] + ''' -
-
+ + + + + + +
 

''' + l[1][0] + '''

 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
DMR ID: ''' + str(l[0]) + ''' 
Location: ''' + l[1][5] + ''' 
Lat, Lon: ''' + l[1][1] + ''', ''' + l[1][2] + ''' 
Description: ''' + l[1][4] + ''' 

URL:

+
 ''' + l[1][3] + ''' 
Device: ''' + l[1][6] + ''' 
''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l[1][0] + '').add_to(f_map) content = f_map._repr_html_() @@ -766,13 +805,13 @@ def create_app(): svr_content = '' for i in sl: try: - if time.time() - ping_list[i.name] < 30: + if time.time() - ping_list[i.name] < 20: svr_status = '''
Online
''' elif time.time() - ping_list[i.name] <= 300: svr_status = '''
- No pings. ( < 5 min.) + Unknown
(No pings, less than 5 min.)
''' elif time.time() - ping_list[i.name] > 300: svr_status = '''
@@ -5575,7 +5614,6 @@ TG #: ''' + str(tg_d.tg) + ''' try: if hblink_req['ping']: ping_list[hblink_req['ping']] = time.time() - print(peer_locations) response = '' except: pass diff --git a/web/templates/map.html b/web/templates/map.html index a909f76..8709948 100644 --- a/web/templates/map.html +++ b/web/templates/map.html @@ -1,17 +1,15 @@ {% extends 'flask_user/_public_base.html' %} {% block content %} - -
-
+

 

+
Map of connected peers. +
+
+
{{markup_content}}
- - - -

 

{% endblock %}