Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pydeck as pdk
- # Sample data URL
- DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-bike-parking.json"
- # Define a hexagon layer with tooltips enabled
- hexagon_layer = pdk.Layer(
- "HexagonLayer",
- data=DATA_URL,
- get_position='[lng, lat]',
- radius=200,
- elevation_scale=4,
- elevation_range=[0, 1000],
- pickable=True, # Enables picking
- extruded=True,
- )
- # Define the initial view state
- view_state = pdk.ViewState(
- longitude=-122.4,
- latitude=37.75,
- zoom=11,
- pitch=50,
- )
- # Define the tooltip
- tooltip = {"html": "<b>Elevation Value:</b> {elevationValue}", "style": {"color": "white"}}
- # Render the deck.gl map with the tooltip
- r = pdk.Deck(
- layers=[hexagon_layer],
- initial_view_state=view_state,
- tooltip=tooltip
- )
- r.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement