Skip to content

Instantly share code, notes, and snippets.

@makella
Created February 26, 2020 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makella/d2cd70b4ff13703a45c81bef52c61fc6 to your computer and use it in GitHub Desktop.
Save makella/d2cd70b4ff13703a45c81bef52c61fc6 to your computer and use it in GitHub Desktop.
Locations Attendees
<!DOCTYPE html>
<html>
<head>
<title>Exported map | CARTO VL</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<script src="http://libs.cartocdn.com/carto-vl/v1.4.4/carto-vl.js"></script>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.js"></script>
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.css" rel="stylesheet" />
<style>
html, body {
margin: 0;
}
#map {
position: absolute;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new mapboxgl.Map({
container: 'map',
style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
center: [29.531250000072532, 30.600093873555394],
zoom: 1
});
carto.setDefaultConfig({
serverURL: 'https://{user}.carto.com'
});
carto.setDefaultAuth({
username: 'cartogl',
apiKey: 'default_public'
});
const source = new carto.source.Dataset("locations_2018_v2");
const viz = new carto.Viz(`
width: 1.5
color: ramp(linear($num,1,5),[#ff00cc,#00ccff])
filter: animation(linear($animating_id,-200,1800),3,fade(0.1,0.5))+0.05
`);
const layer = new carto.Layer('layer', source, viz);
layer.addTo(map, 'watername_ocean');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment