Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
feat: add cam icons
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-milan committed Nov 13, 2023
1 parent 549ad39 commit 97bca0e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@
import pydeck as pdk
import streamlit as st

ICON_URL = "https://cdn-icons-png.flaticon.com/512/2060/2060364.png"
icon_data = {
# Icon from Wikimedia, used the Creative Commons Attribution-Share Alike 3.0
# Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic licenses
"url": ICON_URL,
"width": 242,
"height": 242,
"anchorY": 242,
}

tmp_data_path = Path(__file__).parent.parent / "data" / "cameras_h3_1.csv"
chart_data = pd.read_csv(tmp_data_path)
chart_data["icon_data"] = None
for i in chart_data.index:
chart_data["icon_data"][i] = icon_data

st.pydeck_chart(
pdk.Deck(
Expand All @@ -19,11 +32,13 @@
),
layers=[
pdk.Layer(
"ScatterplotLayer",
"IconLayer",
data=chart_data,
get_icon="icon_data",
get_position="[longitude, latitude]",
get_color="[200, 30, 0, 160]",
get_radius=200,
get_size=4,
size_scale=5,
pickable=True,
),
],
tooltip={
Expand Down

0 comments on commit 97bca0e

Please sign in to comment.