This repository has been archived by the owner on May 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·142 lines (126 loc) · 3.49 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OSM Tile Cacher with Leaflet</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<style>
body {
margin:0;
background:#666;
color: #ccc
}
a {
color: #eee
}
h3 {
margin:0;
float: left;
}
h3 a {
color:#ccc;
}
#map {
position:absolute;
top:30px;
right:0;
left:0;
bottom:0;
background:#fff;
}
#ctrls {
padding:6px 0;
width:150px;
margin:14px;
background: #fff;
box-shadow: 0 1px 7px rgba(0,0,0,0.4);
border: 1px solid #888;
color:#00e;
opacity: .60;
border-radius: 8px;
}
#url {
font-size:14px;
}
#copy {
position:absolute;
z-index:5000;
right:140px;
color:#000;
top:-6px;
font-style:italic;
font-size:.85em;
padding:5px 8px;
background: #aaa;
border:2px solid #c5cdd4;
border-radius:.7em;
opacity: 0.8;
}
</style>
</head>
<body>
<div style="padding-top:4px;">
<h3><a href="https://github.com/stefanocudini/osm-tile-cacher">Osm Tile Cacher</a> </h3>
<iframe style="vertical-align:baseline" src="http://ghbtns.com/github-btn.html?user=stefanocudini&repo=osm-tile-cacher&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="104px" height="20px"></iframe>
Other useful stuff for <a href="http://labs.easyblog.it/maps/">Web Mapping...</a>
</div>
<div id="map"></div>
<div id="copy"><a href="http://labs.easyblog.it/">Labs</a> • <a rel="author" href="http://labs.easyblog.it/stefano-cudini/">Stefano Cudini</a></div>
<a href="https://github.com/stefanocudini/osm-tile-cacher"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet-src.js"></script>
<script>
$(function() {
$.getJSON('./tmsfake.php?getopt', function(opts) {
if(!!opts.ckdown)
$('#ckdown').prop("checked", true);
});
var tileOpts = {
updateWhenIdle:false,
updateInterval:0,
keepBuffer:0
},
zoomStart = 13,
centerStart = [46.05977203062134, 11.120567321777346],
greyLayer = new L.TileLayer('http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png'),
osmLayer = new L.TileLayer(location.href+'./tmsfake.php?{z}/{x}/{y}.png',tileOpts),
cacheLayer = new L.TileLayer(location.href+'./cache-tiles/{z}/{x}/{y}.png',tileOpts);
window.map = new L.Map('map',{
center: centerStart
});
map.setView(centerStart, zoomStart);
map.addLayer(greyLayer);
L.Util.extend(
L.control({position:'bottomleft'}),
{
onAdd: function(map) {
return $('<div id="ctrls">'+
'<label><input id="ckdown" type="checkbox" />Force Update Tiles</label>'+
'<input id="url" size="50" type="text" value="" />'+
'<pre></pre></div>')[0];
}
}
).addTo(map);
L.control.layers({
"Caching Tiles": osmLayer,
"Cached Tiles": cacheLayer
}, {
}, {
position:'bottomleft',
collapsed:false
}).addTo(map);
$('#ckdown').on('change', function(e) {
$('#ctrls pre').text('loading...').load('tmsfake.php',{ setopt: 1, ckdown: $(e.target).is(":checked") });
});
map.on('layeradd', function (e) {
console.log(e)
$('#url').val(e.layer._url)
});
map.addLayer(osmLayer);
$('#url').on('focus', function() {
$(this).select()
})
});
</script>
<script type="text/javascript" src="/labs-common.js"></script>
</body>
</html>