-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
67 lines (57 loc) · 1.78 KB
/
index.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>
<meta charset=utf-8 />
<title>Compare OSM to Google Maps</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.js'></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<style>
.range {
position:absolute;
width:100%;
z-index: 99999;
}
.leaflet-top .leaflet-control-zoom {
top:20px;
}
.leaflet-google-layer {
z-index: 0;
}
.leaflet-layer {
background-color: #FFF;
}
</style>
<div id='map'></div>
<input id='range' class='range' type='range' min='0' max='1.0' step='any' />
<script>
L.mapbox.accessToken = 'pk.eyJ1IjoiY3Jvd2Rjb3ZlciIsImEiOiI3akYtNERRIn0.uwBAdtR6Zk60Bp3vTKj-kg';
var map = L.mapbox.map('map');
map.attributionControl.setPosition("bottomleft");
//L.mapbox.tileLayer('mapbox.outdoors').addTo(map);
var layer = new L.Google('ROADMAP');
map.addLayer(layer);
var overlay = L.mapbox.tileLayer('mapbox.streets').addTo(map);
map.addLayer(overlay);
var range = document.getElementById('range');
function clip() {
var nw = map.containerPointToLayerPoint([0, 0]),
se = map.containerPointToLayerPoint(map.getSize()),
clipX = nw.x + (se.x - nw.x) * range.value;
overlay.getContainer().style.clip = 'rect(' + [nw.y, clipX, se.y, nw.x].join('px,') + 'px)';
}
range['oninput' in range ? 'oninput' : 'onchange'] = clip;
map.on('move', clip);
map.setView([-1.9180,18.2805], 15);
clip();
</script>
</body>
</html>