Skip to content

Instantly share code, notes, and snippets.

@andy-esch
Last active August 29, 2015 14:13
Show Gist options
  • Save andy-esch/4179b6e0162f8175b39d to your computer and use it in GitHub Desktop.
Save andy-esch/4179b6e0162f8175b39d to your computer and use it in GitHub Desktop.
Named Map example using Leaflet
<!DOCTYPE html>
<html>
<head>
<title>Lesson 1 | CartoDB.js | CartoDB</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<!-- Map takes up full browser window -->
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<!-- Drop your code between the script tags below! -->
<script>
// Choose center and zoom level
var options = {
center: [41.8369, -87.6847], // Chicago
zoom: 4
}
// Instantiate map on specified DOM element
var map_object = new L.Map('map', options);
// Add a basemap to the map object just created
L.tileLayer('http://{s}.ashbu.cartocdn.com/andye/api/v1/map/andye@fc050569@566b9c8a7747ad12087d5dbb6ac7110f:1420660181313.09/{z}/{x}/{y}.png')
.addTo(map_object);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment