forked from visgl/deck.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscatterplot-layer.html
More file actions
49 lines (41 loc) · 1.27 KB
/
scatterplot-layer.html
File metadata and controls
49 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
<head>
<title>deck.gl ScatterplotLayer Example</title>
<script src="https://unpkg.com/deck.gl@^9.0.0/dist.min.js"></script>
<script src='https://unpkg.com/maplibre-gl@3.6.0/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@3.6.0/dist/maplibre-gl.css' rel='stylesheet' />
<style type="text/css">
body {
width: 100vw;
height: 100vh;
margin: 0;
}
</style>
</head>
<body></body>
<script type="text/javascript">
const {DeckGL, ScatterplotLayer} = deck;
const MALE_COLOR = [0, 128, 255];
const FEMALE_COLOR = [255, 0, 128];
new DeckGL({
mapStyle: 'https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json',
initialViewState: {
longitude: -74,
latitude: 40.76,
zoom: 11,
maxZoom: 16
},
controller: true,
layers: [
new ScatterplotLayer({
id: 'scatter-plot',
data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/scatterplot/manhattan.json',
radiusScale: 10,
radiusMinPixels: 0.5,
getPosition: d => [d[0], d[1], 0],
getColor: d => (d[2] === 1 ? MALE_COLOR : FEMALE_COLOR)
})
]
});
</script>
</html>