SYNC COMMIT

This commit is contained in:
Sebastian Lenzlinger committed 2024-01-04 18:20:55 +01:00
1 parent 843ed0a1a3
commit 6af1f734ef
4 files changed
+228 -120

No files matched your search

+100 -8
View File
@@ -5,8 +5,10 @@ import folium
from folium import plugins
import logging
from db_connector import RemoteDB
from shapely import wkb
import json
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('map.py')
stream_handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -28,13 +30,44 @@ fixed_map_zurich_original_coords = folium.Map(
doubleClickZoom=False
)
gradient = {
0.1: 'blue',
0.3: 'cyan',
0.5: 'lime',
0.7: 'yellow',
0.9: 'red'
}
interactive_map = folium.Map(
location=zurich_coordinates,
zoom_start=13,
zoom_control=True,
dragging=True,
scrollWheelZoom=True,
doubleClickZoom=False,
tiles="cartodb positron"
)
speedLimits = ["T0","T10","T20","T30","T50","T60","T80","T100"]
color_dict = {
"T0": "red",
"T10": "blue",
"T20": "orange",
"T30": "green",
"T50": "yellow",
"T60": "purple",
"T80": "pink",
"T100": "gray"
}
def create_heat_view():
create_heat_view_sql = """
CREATE VIEW heat AS
SELECT
ST_Y(geometry) AS latitude,
ST_X(geometry) AS longitude,
AccidentYear AS Weight
AccidentYear AS year
FROM
accidents
WHERE
@@ -49,10 +82,10 @@ def create_heat_view():
logger.info("Heat View Created")\
def get_heat_view():
create_heat_view()
#create_heat_view()
get_heat_view_sql = """
SELECT latitude, longitude, weight
SELECT latitude, longitude, year
FROM heat;
"""
@@ -61,17 +94,76 @@ def get_heat_view():
# Get heat map data from database
try:
result = remote_db.execute_query(get_heat_view_sql)
logger.info(f"Succesfully retrieved result {result}")
logger.info(f"Succesfully retrieved result")
return result
except Exception as e:
logger.exception(f"Failed getting result with exception {e}")
finally:
remote_db.close()
def create_acc_map():
def create_heat_map_with_time():
# Process heat map data
pass
#heat_df = pd.DataFrame(result, columns=['latitude', 'longitude', 'weight'])
heat_view_data = get_heat_view()
heat_df = gpd.GeoDataFrame(heat_view_data, columns=['latitude', 'longitude', 'year'])
assert not heat_df.empty, f" Heat Dataframe is empty: {heat_df.head(5)}"
heat_data = [[[row['latitude'], row['longitude']] for index, row in heat_df[heat_df['year'] == i].iterrows()] for
i in range(2011, 2023)]
index = [2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022]
# plot heat map
hm = plugins.HeatMapWithTime(heat_data,
auto_play=False,
max_opacity=0.8,
index=index,
name="Accident Heatmap")
hm.add_to(interactive_map)
# Add signald speeds data
sig_speeds_data = get_signaled_speed_sql()
sig_speed_df = gpd.GeoDataFrame(sig_speeds_data, columns=['tempo','wkb_geometry'])
sig_speed_df['geometry'] = sig_speed_df['wkb_geometry'].apply(lambda x: wkb.loads(x, hex=True))
for speedlimit in speedLimits:
signal_speed = sig_speed_df[sig_speed_df["tempo"].str.contains(speedlimit, case=False)]
geometry = signal_speed['geometry']
folium.GeoJson(
data=geometry,
name=f'Signaled Speed {speedlimit}',
color=color_dict[speedlimit],
show=False,
line_cap="butt",
).add_to(interactive_map)
folium.LayerControl(collapsed=True).add_to(interactive_map)
def get_signaled_speed_sql():
sigspeed_sql = """
SELECT
temporegime_technical as tempo,
wkb_geometry
FROM signaled_speeds;
"""
remote_db = RemoteDB()
try:
result = remote_db.execute_query(sigspeed_sql)
logger.info(f"Succesfully retrieved result")
return result
except Exception as e:
logger.exception(f"Failed getting result with exception {e}")
finally:
remote_db.close()
def save_map_as_html(map, name):
map.save(f"{name}.html")
logger.info(f"Succesfully saved map {name}.")
if __name__ == "__main__":
create_heat_map_with_time()
save_map_as_html(interactive_map, "heat_map_with_time")
+104 -106
View File
@@ -7,8 +7,8 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-01-04T15:06:22.066455620Z",
"start_time": "2024-01-04T15:06:21.950613935Z"
"end_time": "2024-01-04T16:29:22.178229818Z",
"start_time": "2024-01-04T16:29:21.982584035Z"
}
},
"outputs": [],
@@ -24,71 +24,71 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2024-01-04 16:06:22,110 - paramiko.transport - DEBUG - starting thread (client mode): 0xd9a91790\n",
"2024-01-04 16:06:22,112 - paramiko.transport - DEBUG - Local version/idstring: SSH-2.0-paramiko_3.4.0\n",
"2024-01-04 16:06:22,151 - paramiko.transport - DEBUG - Remote version/idstring: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6\n",
"2024-01-04 16:06:22,152 - paramiko.transport - INFO - Connected (version 2.0, client OpenSSH_8.9p1)\n",
"2024-01-04 16:06:22,188 - paramiko.transport - DEBUG - === Key exchange possibilities ===\n",
"2024-01-04 16:06:22,188 - paramiko.transport - DEBUG - kex algos: curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, sntrup761x25519-sha512@openssh.com, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, kex-strict-s-v00@openssh.com\n",
"2024-01-04 16:06:22,189 - paramiko.transport - DEBUG - server key: rsa-sha2-512, rsa-sha2-256, ecdsa-sha2-nistp256, ssh-ed25519\n",
"2024-01-04 16:06:22,189 - paramiko.transport - DEBUG - client encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 16:06:22,190 - paramiko.transport - DEBUG - server encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 16:06:22,190 - paramiko.transport - DEBUG - client mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 16:06:22,190 - paramiko.transport - DEBUG - server mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 16:06:22,190 - paramiko.transport - DEBUG - client compress: none, zlib@openssh.com\n",
"2024-01-04 16:06:22,190 - paramiko.transport - DEBUG - server compress: none, zlib@openssh.com\n",
"2024-01-04 16:06:22,191 - paramiko.transport - DEBUG - client lang: <none>\n",
"2024-01-04 16:06:22,191 - paramiko.transport - DEBUG - server lang: <none>\n",
"2024-01-04 16:06:22,191 - paramiko.transport - DEBUG - kex follows: False\n",
"2024-01-04 16:06:22,191 - paramiko.transport - DEBUG - === Key exchange agreements ===\n",
"2024-01-04 16:06:22,192 - paramiko.transport - DEBUG - Strict kex mode: True\n",
"2024-01-04 16:06:22,192 - paramiko.transport - DEBUG - Kex: curve25519-sha256@libssh.org\n",
"2024-01-04 16:06:22,192 - paramiko.transport - DEBUG - HostKey: ssh-ed25519\n",
"2024-01-04 16:06:22,192 - paramiko.transport - DEBUG - Cipher: aes128-ctr\n",
"2024-01-04 16:06:22,193 - paramiko.transport - DEBUG - MAC: hmac-sha2-256\n",
"2024-01-04 16:06:22,193 - paramiko.transport - DEBUG - Compression: none\n",
"2024-01-04 16:06:22,193 - paramiko.transport - DEBUG - === End of kex handshake ===\n",
"2024-01-04 16:06:22,271 - paramiko.transport - DEBUG - Resetting outbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 16:06:22,271 - paramiko.transport - DEBUG - kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>\n",
"2024-01-04 16:06:22,272 - paramiko.transport - DEBUG - Switch to new keys ...\n",
"2024-01-04 16:06:22,272 - paramiko.transport - DEBUG - Resetting inbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 16:06:22,272 - paramiko.transport - DEBUG - Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com', 'publickey-hostbound@openssh.com': b'0'}\n",
"2024-01-04 16:06:22,272 - paramiko.transport - DEBUG - Attempting public-key auth...\n",
"2024-01-04 16:06:22,371 - paramiko.transport - DEBUG - userauth is OK\n",
"2024-01-04 16:06:22,417 - paramiko.transport - INFO - Authentication (publickey) failed.\n",
"2024-01-04 16:06:22,450 - paramiko.transport - DEBUG - starting thread (client mode): 0xd9a9af10\n",
"2024-01-04 16:06:22,451 - paramiko.transport - DEBUG - Local version/idstring: SSH-2.0-paramiko_3.4.0\n",
"2024-01-04 16:06:22,488 - paramiko.transport - DEBUG - Remote version/idstring: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6\n",
"2024-01-04 16:06:22,488 - paramiko.transport - INFO - Connected (version 2.0, client OpenSSH_8.9p1)\n",
"2024-01-04 16:06:22,512 - paramiko.transport - DEBUG - === Key exchange possibilities ===\n",
"2024-01-04 16:06:22,513 - paramiko.transport - DEBUG - kex algos: curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, sntrup761x25519-sha512@openssh.com, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, kex-strict-s-v00@openssh.com\n",
"2024-01-04 16:06:22,514 - paramiko.transport - DEBUG - server key: rsa-sha2-512, rsa-sha2-256, ecdsa-sha2-nistp256, ssh-ed25519\n",
"2024-01-04 16:06:22,514 - paramiko.transport - DEBUG - client encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 16:06:22,514 - paramiko.transport - DEBUG - server encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 16:06:22,514 - paramiko.transport - DEBUG - client mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 16:06:22,515 - paramiko.transport - DEBUG - server mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 16:06:22,515 - paramiko.transport - DEBUG - client compress: none, zlib@openssh.com\n",
"2024-01-04 16:06:22,515 - paramiko.transport - DEBUG - server compress: none, zlib@openssh.com\n",
"2024-01-04 16:06:22,516 - paramiko.transport - DEBUG - client lang: <none>\n",
"2024-01-04 16:06:22,516 - paramiko.transport - DEBUG - server lang: <none>\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - kex follows: False\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - === Key exchange agreements ===\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - Strict kex mode: True\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - Kex: curve25519-sha256@libssh.org\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - HostKey: ssh-ed25519\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - Cipher: aes128-ctr\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - MAC: hmac-sha2-256\n",
"2024-01-04 16:06:22,517 - paramiko.transport - DEBUG - Compression: none\n",
"2024-01-04 16:06:22,518 - paramiko.transport - DEBUG - === End of kex handshake ===\n",
"2024-01-04 16:06:22,518 - paramiko.transport - DEBUG - EOF in transport thread\n",
"2024-01-04 16:06:22,597 - paramiko.transport - DEBUG - Resetting outbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 16:06:22,598 - paramiko.transport - DEBUG - kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>\n",
"2024-01-04 16:06:22,599 - paramiko.transport - DEBUG - Switch to new keys ...\n",
"2024-01-04 16:06:22,600 - paramiko.transport - DEBUG - Resetting inbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 16:06:22,601 - paramiko.transport - DEBUG - Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com', 'publickey-hostbound@openssh.com': b'0'}\n",
"2024-01-04 16:06:22,601 - paramiko.transport - DEBUG - Attempting public-key auth...\n",
"2024-01-04 16:06:22,694 - paramiko.transport - DEBUG - userauth is OK\n",
"2024-01-04 16:06:22,752 - paramiko.transport - INFO - Authentication (publickey) successful!\n"
"2024-01-04 17:29:22,165 - paramiko.transport - DEBUG - starting thread (client mode): 0xd85d5690\n",
"2024-01-04 17:29:22,166 - paramiko.transport - DEBUG - Local version/idstring: SSH-2.0-paramiko_3.4.0\n",
"2024-01-04 17:29:22,202 - paramiko.transport - DEBUG - Remote version/idstring: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6\n",
"2024-01-04 17:29:22,202 - paramiko.transport - INFO - Connected (version 2.0, client OpenSSH_8.9p1)\n",
"2024-01-04 17:29:22,232 - paramiko.transport - DEBUG - === Key exchange possibilities ===\n",
"2024-01-04 17:29:22,233 - paramiko.transport - DEBUG - kex algos: curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, sntrup761x25519-sha512@openssh.com, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, kex-strict-s-v00@openssh.com\n",
"2024-01-04 17:29:22,233 - paramiko.transport - DEBUG - server key: rsa-sha2-512, rsa-sha2-256, ecdsa-sha2-nistp256, ssh-ed25519\n",
"2024-01-04 17:29:22,233 - paramiko.transport - DEBUG - client encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - server encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - client mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - server mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - client compress: none, zlib@openssh.com\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - server compress: none, zlib@openssh.com\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - client lang: <none>\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - server lang: <none>\n",
"2024-01-04 17:29:22,234 - paramiko.transport - DEBUG - kex follows: False\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - === Key exchange agreements ===\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - Strict kex mode: True\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - Kex: curve25519-sha256@libssh.org\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - HostKey: ssh-ed25519\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - Cipher: aes128-ctr\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - MAC: hmac-sha2-256\n",
"2024-01-04 17:29:22,235 - paramiko.transport - DEBUG - Compression: none\n",
"2024-01-04 17:29:22,236 - paramiko.transport - DEBUG - === End of kex handshake ===\n",
"2024-01-04 17:29:22,270 - paramiko.transport - DEBUG - Resetting outbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 17:29:22,271 - paramiko.transport - DEBUG - kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>\n",
"2024-01-04 17:29:22,271 - paramiko.transport - DEBUG - Switch to new keys ...\n",
"2024-01-04 17:29:22,272 - paramiko.transport - DEBUG - Resetting inbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 17:29:22,272 - paramiko.transport - DEBUG - Attempting public-key auth...\n",
"2024-01-04 17:29:22,272 - paramiko.transport - DEBUG - Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com', 'publickey-hostbound@openssh.com': b'0'}\n",
"2024-01-04 17:29:22,369 - paramiko.transport - DEBUG - userauth is OK\n",
"2024-01-04 17:29:22,409 - paramiko.transport - INFO - Authentication (publickey) failed.\n",
"2024-01-04 17:29:22,436 - paramiko.transport - DEBUG - starting thread (client mode): 0xb32a2d10\n",
"2024-01-04 17:29:22,437 - paramiko.transport - DEBUG - Local version/idstring: SSH-2.0-paramiko_3.4.0\n",
"2024-01-04 17:29:22,473 - paramiko.transport - DEBUG - Remote version/idstring: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6\n",
"2024-01-04 17:29:22,474 - paramiko.transport - INFO - Connected (version 2.0, client OpenSSH_8.9p1)\n",
"2024-01-04 17:29:22,499 - paramiko.transport - DEBUG - === Key exchange possibilities ===\n",
"2024-01-04 17:29:22,500 - paramiko.transport - DEBUG - kex algos: curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, sntrup761x25519-sha512@openssh.com, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, kex-strict-s-v00@openssh.com\n",
"2024-01-04 17:29:22,500 - paramiko.transport - DEBUG - server key: rsa-sha2-512, rsa-sha2-256, ecdsa-sha2-nistp256, ssh-ed25519\n",
"2024-01-04 17:29:22,500 - paramiko.transport - DEBUG - client encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 17:29:22,500 - paramiko.transport - DEBUG - server encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - client mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - server mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - client compress: none, zlib@openssh.com\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - server compress: none, zlib@openssh.com\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - client lang: <none>\n",
"2024-01-04 17:29:22,501 - paramiko.transport - DEBUG - server lang: <none>\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - kex follows: False\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - === Key exchange agreements ===\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - Strict kex mode: True\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - Kex: curve25519-sha256@libssh.org\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - HostKey: ssh-ed25519\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - Cipher: aes128-ctr\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - MAC: hmac-sha2-256\n",
"2024-01-04 17:29:22,502 - paramiko.transport - DEBUG - Compression: none\n",
"2024-01-04 17:29:22,503 - paramiko.transport - DEBUG - === End of kex handshake ===\n",
"2024-01-04 17:29:22,510 - paramiko.transport - DEBUG - EOF in transport thread\n",
"2024-01-04 17:29:22,585 - paramiko.transport - DEBUG - Resetting outbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 17:29:22,585 - paramiko.transport - DEBUG - kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>\n",
"2024-01-04 17:29:22,586 - paramiko.transport - DEBUG - Switch to new keys ...\n",
"2024-01-04 17:29:22,586 - paramiko.transport - DEBUG - Resetting inbound seqno after NEWKEYS due to strict mode\n",
"2024-01-04 17:29:22,586 - paramiko.transport - DEBUG - Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com', 'publickey-hostbound@openssh.com': b'0'}\n",
"2024-01-04 17:29:22,587 - paramiko.transport - DEBUG - Attempting public-key auth...\n",
"2024-01-04 17:29:22,677 - paramiko.transport - DEBUG - userauth is OK\n",
"2024-01-04 17:29:22,740 - paramiko.transport - INFO - Authentication (publickey) successful!\n"
]
}
],
@@ -98,67 +98,65 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-04T15:06:22.784599466Z",
"start_time": "2024-01-04T15:06:22.066355304Z"
"end_time": "2024-01-04T16:29:22.769191585Z",
"start_time": "2024-01-04T16:29:22.177669866Z"
}
},
"id": "62c8f38132d5cd27"
},
{
"cell_type": "code",
"execution_count": 3,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-01-04 16:06:22,785 - paramiko.transport - DEBUG - [chan 0] Max packet in: 32768 bytes\n",
"2024-01-04 16:06:22,810 - paramiko.transport - DEBUG - Received global request \"hostkeys-00@openssh.com\"\n",
"2024-01-04 16:06:22,811 - paramiko.transport - DEBUG - Rejecting \"hostkeys-00@openssh.com\" global request from server.\n",
"2024-01-04 16:06:22,812 - paramiko.transport - DEBUG - Debug msg: b'/home/sebl/.ssh/authorized_keys:4: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding'\n",
"2024-01-04 16:06:22,835 - paramiko.transport - DEBUG - [chan 0] Max packet out: 32768 bytes\n",
"2024-01-04 16:06:22,835 - paramiko.transport - DEBUG - Secsh channel 0 opened.\n",
"2024-01-04 16:06:23,924 - paramiko.transport - DEBUG - [chan 0] EOF sent (0)\n",
"2024-01-04 16:06:23,925 - paramiko.transport - DEBUG - [chan 1] Max packet in: 32768 bytes\n",
"2024-01-04 16:06:23,960 - paramiko.transport - DEBUG - [chan 0] EOF received (0)\n",
"2024-01-04 16:06:24,128 - paramiko.transport - DEBUG - [chan 1] Max packet out: 32768 bytes\n",
"2024-01-04 16:06:24,129 - paramiko.transport - DEBUG - Secsh channel 1 opened.\n"
]
}
],
"source": [
"result = remote_db.execute_query(\"select * from footbikecount where id = 1\")"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-04T15:06:24.838445832Z",
"start_time": "2024-01-04T15:06:22.786527573Z"
}
},
"id": "29b60614b47dbc87"
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [
{
"data": {
"text/plain": "(1, 1250443, 2678956, '2012-01-01', 0, 0, 0, 0, 0, 'Sunday')"
"text/plain": "[('T20', '0105000020E61000000100000001020000000700000048F8DEDFA00D21405260014C19AC474079B0C56E9F0D2140DBFB54151AAC4740E08618AF790D21406AC2F69331AC474074452921580D2140A20DC00644AC4740F14927124C0D214052D4997B48AC4740FC89CA86350D21405BB22AC24DAC47405B99F04BFD0C21402C7FBE2D58AC4740'),\n ('T0', '0105000020E6100000010000000102000000030000001E34BBEEAD10214092EBA694D7B44740813FFCFCF7102140D2A6EA1ED9B447400F98874CF9102140F1F3DF83D7B44740'),\n ('T30', '0105000020E6100000010000000102000000030000007C293C68760D2140B806B64AB0B0474079CDAB3AAB0D21408E90813CBBB04740ACAC6D8AC70D214001892650C4B04740'),\n ('T50', '0105000020E610000001000000010200000002000000D40AD3F71A1221408690F3FE3FAE4740FBB2B453731121407B1684F23EAE4740'),\n ('T50', '0105000020E61000000100000001020000000500000031B610E4A0242140B16CE690D4B0474094C151F2EA24214072FC5069C4B047409CFC169D2C252140C7A17E17B6B047408A0453CDAC2521405890662C9AB047409B3BFA5FAE252140643E20D099B04740'),\n ('T0', '0105000020E610000001000000010200000002000000A2B5A2CD71162140D9EBDD1FEFAF47403B8DB454DE162140B3791C06F3AF4740'),\n ('T20', '0105000020E6100000010000000102000000020000004B1E4FCB0F0421401C2444F982AE474024287E8CB9032140DC7F643A74AE4740'),\n ('T50', '0105000020E6100000010000000102000000020000005F45460724192140EDD79DEE3CAF4740BCB0355B79192140E146CA1649AF4740'),\n ('T30', '0105000020E6100000010000000102000000020000006DE525FF930F2140691D554D10B14740F6984869360F21408753E6E61BB14740'),\n ('T0', '0105000020E610000001000000010200000003000000C6A52A6D71152140A2CF471971AF474047E9D2BF24152140D978B0C56EAF47400B9A965819152140C70DBF9B6EAF4740'),\n ('T30', '0105000020E61000000100000001020000000300000063D520CCED1E2140E1CFF0660DB44740CFBF5DF6EB1E2140878A71FE26B44740A1D79FC4E71E2140CD3CB9A640B44740'),\n ('T50', '0105000020E610000001000000010200000002000000B4ACFBC74214214044A7E7DD58B447402158552FBF132140A9BD88B663B44740'),\n ('T50', '0105000020E610000001000000010200000003000000E04BE141B30B2140815F234910B24740703FE081010C2140ACC8E88024B2474026547078410C2140207A522635B24740'),\n ('T30', '0105000020E6100000010000000102000000020000008E5BCCCF0D1D2140494DBB9866B047403D0AD7A3701D2140FFD0CC936BB04740'),\n ('T30', '0105000020E6100000010000000102000000030000006C770FD07D192140F04DD36707AE47403602F1BA7E192140F04DD36707AE4740DD7A4D0F0A1A2140520FD1E80EAE4740'),\n ('T30', '0105000020E61000000100000001020000000200000095826E2F690C21401442075DC2AF4740E8C072840C0C2140A04FE449D2AF4740'),\n ('T0', '0105000020E610000001000000010200000002000000F969DC9BDF00214003931B45D6B24740D482177D050121403468E89FE0B24740'),\n ('T50', '0105000020E61000000100000001020000000300000055BDFC4E93192140E144F46BEBB34740E998F38C7D1921404CC79C67ECB347409015FC36C4182140C4B0C398F4B34740'),\n ('T30', '0105000020E61000000100000001020000000200000052802898310D2140450F7C0C56B04740D11F9A79720D214017618A7269B04740'),\n ('T0', '0105000020E61000000100000001020000000300000000E2AE5E450E2140E5D2F88557B247404A7B832F4C0E2140FCC6D79E59B24740063065E0800E2140CAC342AD69B24740'),\n ('T20', '0105000020E610000001000000010200000002000000FAB48AFED0242140003B376DC6B34740ED9FA701832421409B92ACC3D1B34740'),\n ('T0', '0105000020E6100000010000000102000000020000003B8DB454DE062140B741EDB776B04740892650C422062140122F4FE78AB04740'),\n ('T30', '0105000020E610000001000000010200000004000000904AB1A3710821409F2287889BAF4740580053060E082140F8A75489B2AF474037AAD381AC072140103E9468C9AF47402BF697DD930721404CDE0033DFAF4740'),\n ('T30', '0105000020E610000001000000010200000002000000B4AA251DE5102140185E49F25CAF474085ED27637C102140C36169E047AF4740'),\n ('T0', '0105000020E6100000010000000102000000020000004ED53DB2B9122140EF8CB62A89B24740F209D9791B1321402C616D8C9DB24740'),\n ('T0', '0105000020E610000001000000010200000002000000F24064912616214049BDA772DAB1474023D74D29AF1521401686C8E9EBB14740'),\n ('T0', '0105000020E610000001000000010200000003000000C34A051555F720408F1B7E37DDB047400805A568E5F6204020CF2EDFFAB047405A0EF450DBF62040A8363811FDB04740'),\n ('T0', '0105000020E6100000010000000102000000030000007FDAA84E071A21406281AFE8D6B547408884EFFD0D1A214060E5D022DBB54740520FD1E80E1A214077D9AF3BDDB54740'),\n ('T0', '0105000020E610000001000000010200000002000000F35A09DD251121405BCEA5B8AAB44740EAB0C22D1F112140DA740470B3B44740'),\n ('T50', '0105000020E6100000010000000102000000030000006B11514CDE10214009F9A067B3AE47405C8DEC4ACB102140CEFA9463B2AE4740C68503215910214019ABCDFFABAE4740'),\n ('T0', '0105000020E610000001000000010200000003000000DD7BB8E4B80B214089247A19C5B24740A12C7C7DAD0B2140CE001764CBB247404C1938A0A50B2140C573B680D0B24740'),\n ('T0', '0105000020E61000000100000001020000000400000005DCF3FC691321403BE12538F5AF47409F2287889B132140C3B645990DB04740605AD427B9132140B7F1272A1BB047409E7939ECBE1321401492CCEA1DB04740'),\n ('T50', '0105000020E61000000100000001020000000300000071CB4752D2132140A67C08AA46B14740450F7C0C56142140C37E4FAC53B147403ACFD8976C1421404BE658DE55B14740'),\n ('T30', '0105000020E6100000010000000102000000020000009BA9108FC41B2140D9D0CDFE40AF4740B6476FB88F1C2140245E9ECE15AF4740'),\n ('T0', 'Line truncated
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sigspeed_sql = \"\"\"\n",
" SELECT \n",
" temporegime_technical as tempo, \n",
" wkb_geometry AS geometry\n",
" FROM signaled_speeds;\n",
" \"\"\"\n",
"result = remote_db.execute_query(sigspeed_sql)\n",
"result"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-04T16:29:44.362107002Z",
"start_time": "2024-01-04T16:29:43.573101962Z"
}
},
"id": "29b60614b47dbc87"
},
{
"cell_type": "code",
"execution_count": 5,
"outputs": [
{
"data": {
"text/plain": "('T20', '0105000020E61000000100000001020000000700000048F8DEDFA00D21405260014C19AC474079B0C56E9F0D2140DBFB54151AAC4740E08618AF790D21406AC2F69331AC474074452921580D2140A20DC00644AC4740F14927124C0D214052D4997B48AC4740FC89CA86350D21405BB22AC24DAC47405B99F04BFD0C21402C7FBE2D58AC4740')"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result[0]"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-04T15:06:24.848769980Z",
"start_time": "2024-01-04T15:06:24.846327294Z"
"end_time": "2024-01-04T16:30:07.107723230Z",
"start_time": "2024-01-04T16:30:07.104921329Z"
}
},
"id": "cddcbd64b8c52d93"
+21 -3
View File
@@ -342,8 +342,7 @@
"55824 47.389583 8.472041 2022.0\n",
"55825 47.363387 8.557256 2022.0\n",
"\n",
"[55826 rows x 3 columns]\n",
"\n"
"[55826 rows x 3 columns]\n"
]
},
{
@@ -1221,7 +1220,26 @@
"id": "28ec4563-f94e-49ba-a2d8-ec49e936d729",
"metadata": {},
"outputs": [],
"source": []
"source": [
"for year in example_years:\n",
" \n",
" year_data = acc_gdf[acc_gdf['AccidentYear'] == year]\n",
" \n",
" \n",
" heatmap_layer = HeatMap(\n",
" data=year_data[['latitude', 'longitude']],\n",
" radius=8, \n",
" gradient=gradient,\n",
" min_opacity=0.5,\n",
" max_opacity=0.8,\n",
" blur=10,\n",
" show=False,\n",
" name=f'Accidents in {year}'\n",
" )\n",
" \n",
" \n",
" heatmap_layer.add_to(interactive_map)"
]
}
],
"metadata": {
+3 -3
View File
@@ -98,11 +98,11 @@ if __name__ == '__main__':
db_info['port'],
accident_table_name)
logger.info('Finished loading accident geojson into db using bash script.')
geojson_loader(signaled_speeds_file,
geojson_loader(accident_loader_script,
signaled_speeds_file,
db_info['database'],
db_info['user'],
db_info['password'],
db_info['host'],
db_info['port'],
signaled_speeds_table_name,
modus='overwrite')
signaled_speeds_table_name)