Fool around with marker groups.

This commit is contained in:
W1CDN 2024-01-15 11:52:30 -06:00
parent 5fb589507e
commit 260e946ab6

View File

@ -129,24 +129,28 @@ def map():
# Make markers for all the frames # Make markers for all the frames
id_counter = 0 id_counter = 0
markers = '' markers = ''
marker_ids = []
for frame in frames: for frame in frames:
if frame['latitude'] != None: if frame['latitude'] != None:
# Create unique ID for each marker # Create unique ID for each marker
idd = 'frame' + str(id_counter) idd = 'frame' + str(id_counter)
id_counter += 1 id_counter += 1
# Create the marker and its pop-up for each shop # Create each marker
markers += "var {idd} = L.marker([{latitude}, {longitude}]);\ markers += "var {idd} = L.marker([{latitude}, {longitude}]);\
{idd}.addTo(map).bindPopup('{from_ssid}');".format(idd=idd, latitude=frame['latitude'],\ {idd}.addTo(map).bindTooltip('{from_ssid}', permanent=true).openTooltip();".format(idd=idd, latitude=frame['latitude'],\
longitude=frame['longitude'], longitude=frame['longitude'],
from_ssid=frame['from'], from_ssid=frame['from'],
created=frame['created']) created=frame['created'])
# Try to make a list of markers for Leaflet, but not working
marker_ids.append(idd)
return render_template('map.html', return render_template('map.html',
station_lat = config['Settings']['station_lat'], station_lat = config['Settings']['station_lat'],
station_lon = config['Settings']['station_lon'], station_lon = config['Settings']['station_lon'],
markers = markers) markers = markers,
marker_ids = marker_ids)
class Packets(Resource): class Packets(Resource):
def get(self): def get(self):