forked from CartoDB/carto.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaflet_namedmap.html
67 lines (55 loc) · 1.51 KB
/
leaflet_namedmap.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html>
<head>
<title>Leaflet multilayer example | CartoDB.js</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" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="../themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<!-- include cartodb.js library -->
<script src="../dist/cartodb.uncompressed.js"></script>
<script>
function main() {
// create leaflet map
var map = L.map('map', {
zoomControl: false,
center: [43, 0],
zoom: 3
})
// add a base layer
L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
attribution: 'Stamen'
}).addTo(map);
// add cartodb layer with one sublayer
cartodb.createLayer(map, {
type: 'namedmap',
tiler_domain: 'localhost.lan',
tiler_port: 8181,
user_name: 'dev',
no_cdn: true,
force_cors: true,
options: {
named_map: {
name: 'testing'
}
}
})
.addTo(map)
.done(function(layer) {
});
}
// you could use $(window).load(main);
window.onload = main;
</script>
</body>
</html>