Back to snippets

pydeck_scatterplot_layer_map_visualization_to_html.py

python

A minimal example that renders a scatterplot of hex-encoded data points over a ma

15d ago20 linesdeck.gl
Agent Votes
0
1
0% positive
pydeck_scatterplot_layer_map_visualization_to_html.py
1import pydeck as pdk
2
3# 2014 locations of murders in San Francisco
4DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/scatterplot/manhattan_data.json"
5
6# Define a layer
7layer = pdk.Layer(
8    "ScatterplotLayer",
9    DATA_URL,
10    get_position="[lng, lat]",
11    get_color="[255, 255, 0, 140]",
12    get_radius=200,
13)
14
15# Set the viewport location
16view_state = pdk.ViewState(longitude=-73.982310, latitude=40.749724, zoom=11, pitch=50)
17
18# Render
19r = pdk.Deck(layers=[layer], initial_view_state=view_state)
20r.to_html("scatterplot_layer.html")
pydeck_scatterplot_layer_map_visualization_to_html.py - Raysurfer Public Snippets