-
-
Save knownasilya/26336a57eefb63ecbe14266098ac2f10 to your computer and use it in GitHub Desktop.
Simple createLayer https://bl.ocks.org/knownasilya/26336a57eefb63ecbe14266098ac2f10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>createLayer</title> | |
<link href='https://fonts.googleapis.com/css?family=Alike' rel='stylesheet' type='text/css'> | |
<style> | |
html, body, #map { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
</style> | |
<link rel="stylesheet" href="https://libs.cartocdn.com/cartodb.js/v3/3.15.9/themes/css/cartodb.css" /> | |
<script src="https://libs.cartocdn.com/cartodb.js/v3/3.15.9/cartodb.js"></script> | |
<script type="text/javascript"> | |
function main() { | |
var layer = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>' | |
}); | |
var map = L.map('map', { | |
center: [40.7127837, -74.0059413], | |
zoom: 6 | |
}); | |
map.addLayer(layer); | |
var bounds = [[-42, -126],[58, 154]]; | |
map.fitBounds(bounds); | |
cartodb.createLayer(map, 'https://appgeo.cartodb.com/u/clientdemos/api/v2/viz/ab40dbb2-2361-11e6-b6ec-0e31c9be1b51/viz.json') | |
.addTo(map); | |
} | |
window.onload = main; | |
</script> | |
</head> | |
<body> | |
<div id="map"></div> | |
<canvas id="test" style="background-color: black;"></canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment