Skip to content

Instantly share code, notes, and snippets.

@stuartlynn
Created September 5, 2018 14:47
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 stuartlynn/73a1fcbcf37dbe42a3a4b2d9ebe4d003 to your computer and use it in GitHub Desktop.
Save stuartlynn/73a1fcbcf37dbe42a3a4b2d9ebe4d003 to your computer and use it in GitHub Desktop.
Pluto
<!DOCTYPE html>
<html>
<head>
<title>Add layer | CARTO</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<!-- Include CARTO VL JS -->
<script src="http://libs.cartocdn.com/carto-vl/v0.7.0/carto-vl.js"></script>
<!-- Include Mapbox GL JS -->
<script src="https://libs.cartocdn.com/mapbox-gl/v0.48.0-carto1/mapbox-gl.js"></script>
<!-- Include Mapbox GL CSS -->
<link href="https://libs.cartocdn.com/mapbox-gl/v0.48.0-carto1/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: [-73.9776471574288, 40.747726378340275],
zoom: 14.136499129338478,
dragRotate: false,
touchZoomRotate: false
});
carto.setDefaultConfig({
serverURL: 'https://{user}.carto.com'
});
carto.setDefaultAuth({
user: 'dmanzanares',
apiKey: 'default_public'
});
const source = new carto.source.Dataset("mnmappluto");
const viz = new carto.Viz(`color: ramp(linear(log($numfloors), 1, 4), Earth)
strokeColor:transparent
`);
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