# Define a layer to display on a map
DATA = 'https://minio.carlboettiger.info/shared-data/mammalia_occ_gb.csv'
import pydeck as pdk
layer = pdk.Layer(
"HexagonLayer",
DATA,
get_position=['lng', 'lat'],
elevation_scale=100,
# elevation_range=[0, 1000],
get_fill_color = ["elevation", "0", "elevation", 140],
extruded=True,
radius=1000,
auto_highlight=True,
pickable=True,
lower_percentile=0.8,
alpha=0.8
)
# Set the viewport location
view_state = pdk.ViewState(
longitude=-1.415,
latitude=52.2323,
zoom=4,
min_zoom=1,
max_zoom=12,
pitch=40.5,
bearing=-27.36)
# Render
r = pdk.Deck(layers=[layer], initial_view_state=view_state)
r.to_html("hex_layer.html")