Skip to content

Instantly share code, notes, and snippets.

@ajduberstein
Last active May 9, 2020 00:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajduberstein/cebd1c71c9fcd73ddea99ff6d643b307 to your computer and use it in GitHub Desktop.
Save ajduberstein/cebd1c71c9fcd73ddea99ff6d643b307 to your computer and use it in GitHub Desktop.
pydeck HexagonLayer demo
import pydeck
# 2014 locations of car accidents in the UK
UK_ACCIDENTS_DATA = ('https://raw.githubusercontent.com/uber-common/'
'deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv')
# Define a layer to display on a map
layer = pydeck.Layer(
'HexagonLayer',
UK_ACCIDENTS_DATA,
get_position='[lng, lat]',
auto_highlight=True,
elevation_scale=50,
pickable=True,
elevation_range=[0, 3000],
extruded=True,
coverage=1)
# Set the viewport location
view_state = pydeck.ViewState(
longitude=-1.415,
latitude=52.2323,
zoom=6,
min_zoom=5,
max_zoom=15,
pitch=40.5,
bearing=-27.36)
# Render
r = pydeck.Deck(layers=[layer], initial_view_state=view_state)
r.to_html('demo.html')
# Please see the note about using a Mapbox API token here:
# https://github.com/uber/deck.gl/tree/master/bindings/python/pydeck#mapbox-api-token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment