Skip to content

Commit

Permalink
Add example using pydeck.Layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Jul 25, 2024
1 parent 0fa4e7d commit 9200b04
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions _experimental/add_pydeck_layer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import json

import pandas as pd
from maplibre import Map, MapOptions
from pydeck import Layer as PyDeckLayer

UK_ACCIDENTS_DATA = (
"https://raw.githubusercontent.com/uber-common/"
"deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv"
)

df = pd.read_csv(UK_ACCIDENTS_DATA)

layer = PyDeckLayer(
"HexagonLayer",
df,
# UK_ACCIDENTS_DATA,
get_position=["lng", "lat"],
auto_highlight=True,
elevation_scale=50,
pickable=True,
elevation_range=[0, 3000],
extruded=True,
coverage=1,
)

m = Map(MapOptions(center=(1.415, 52.2323), zoom=6))
m.add_deck_layers([json.loads(layer.to_json())])
m.save("/tmp/py-maplibre-express.html")

0 comments on commit 9200b04

Please sign in to comment.