Created
June 20, 2020 11:28
-
-
Save smstuebe/5c066f73b6a196b0e36ee559682d1dd5 to your computer and use it in GitHub Desktop.
Headmap to visualize COVID BLE App data on a heatmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired from https://twitter.com/merlinchlosta/status/1273293511803244546 | |
# data read via RaMBLE App | |
# install | |
# pip install gmaps (requires API key) | |
# enable gmaps in jupyter | |
# jupyter nbextension enable --py --sys-prefix widgetsnbextension | |
# jupyter nbextension enable --py --sys-prefix gmaps | |
import sqlite3 | |
import gmaps | |
import gmaps.datasets | |
gmaps.configure(api_key='AI...your api key here ...') | |
conn = sqlite3.connect('D:\...path to the exported databasee...\db.sqlite') | |
qry = '''SELECT | |
locations.latitude, | |
locations.longitude | |
FROM devices | |
INNER JOIN locations ON devices.id = locations.device_id | |
WHERE devices.service_data LIKE 'fd6f:%' | |
ORDER BY locations.timestamp''' | |
locations = conn.execute(qry).fetchall() | |
fig = gmaps.figure() | |
heatmap_layer = gmaps.heatmap_layer(locations) | |
fig.add_layer(heatmap_layer) | |
fig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment