clean peer location on map

This commit is contained in:
KF7EEL 2021-10-05 10:00:31 -07:00
parent ceb42fac61
commit c08fa3badd

View File

@ -735,6 +735,54 @@ def hbnet_web_service():
return render_template('flask_user_layout.html', markup_content = Markup(content)) return render_template('flask_user_layout.html', markup_content = Markup(content))
@app.route('/map/<dmr_id>')
@login_required
def single_peer(dmr_id):
try:
l = PeerLoc.query.filter_by(dmr_id=dmr_id).first()
content = '''
<table border="1">
<tbody>
<tr>
<td>&nbsp;<strong><h4>''' + l.callsign + '''</strong></h4>&nbsp;</td>
</tr>
</tbody>
</table>
<table border="1">
<tbody>
<tr>
<td style="width: 64.4667px;"><strong>DMR ID:</strong></td>
<td>&nbsp;''' + str(l.dmr_id) + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Location:</strong></td>
<td>&nbsp;''' + l.loc + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Lat, Lon:</strong></td>
<td>&nbsp;''' + l.lat + ''', ''' + l.lon + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Description:</strong></td>
<td>&nbsp;''' + l.comment + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><p><strong>URL:</strong></p>
</td>
<td><a href="''' + l.url + '''">&nbsp;''' + l.url + '''&nbsp;</a></td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Device:</strong></td>
<td>&nbsp;''' + l.software + '''&nbsp;</td>
</tr>
</tbody>
</table>
'''
except:
content = 'No peer found.'
return render_template('single_map_peer.html', markup_content = Markup(content))
@app.route('/map') @app.route('/map')
@login_required @login_required
def map_page(): def map_page():
@ -796,42 +844,27 @@ def hbnet_web_service():
## ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map) ## ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map)
folium.Marker([float(l.lat), float(l.lon)], popup=''' folium.Marker([float(l.lat), float(l.lon)], popup='''
<table border="1"> <table style="width: 100px; height: 100px;">
<tbody> <tbody>
<tr> <tr>
<td>&nbsp;<strong><h4>''' + l.callsign + '''</strong></h4>&nbsp;</td> <td>
</tr> <table>
</tbody>
</table>
<table border="1">
<tbody> <tbody>
<tr> <tr>
<td style="width: 64.4667px;"><strong>DMR ID:</strong></td> <td>
<td>&nbsp;''' + str(l.dmr_id) + '''&nbsp;</td> <p><h4><a href="''' + url + '/map/' + str(l.dmr_id) + '''" target="_blank" rel="noopener"><strong>''' + l.callsign + '''</strong></a></h4></p>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Location:</strong></td>
<td>&nbsp;''' + l.loc + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Lat, Lon:</strong></td>
<td>&nbsp;''' + l.lat + ''', ''' + l.lon + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><strong>Description:</strong></td>
<td>&nbsp;''' + l.comment + '''&nbsp;</td>
</tr>
<tr>
<td style="width: 64.4667px;"><p><strong>URL:</strong></p>
</td> </td>
<td><a href="''' + l.url + '''">&nbsp;''' + l.url + '''&nbsp;</a></td>
</tr> </tr>
<tr> <tr>
<td style="width: 64.4667px;"><strong>Device:</strong></td> <td>''' + l.loc + '''</td>
<td>&nbsp;''' + l.software + '''&nbsp;</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</td>
</tr>
</tbody>
</table>
''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l.callsign + '</strong>').add_to(f_map) ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l.callsign + '</strong>').add_to(f_map)
content = f_map._repr_html_() content = f_map._repr_html_()