This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest-raster.html
46 lines (46 loc) · 1.88 KB
/
test-raster.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<title>Cartago Raster Maps Demo</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.min.css">
<style>
body {
margin: 0;
padding: 0;
}
#map {
height: 100%;
position: absolute;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/leaflet-hash.min.js"></script>
<script>
var map = L.map("map", {
attributionControl: false,
center: [51.508, -0.128],
zoom: 3,
});
var layers = {
"Cartago Streets": L.tileLayer("http://localhost:8080/styles/cartago-streets/{z}/{x}/{y}{r}.png"),
"Cartago Streets English": L.tileLayer("http://localhost:8080/styles/cartago-streets-english/{z}/{x}/{y}{r}.png"),
"Cartago Car": L.tileLayer("http://localhost:8080/styles/cartago-car/{z}/{x}/{y}{r}.png"),
"Cartago Car English": L.tileLayer("http://localhost:8080/styles/cartago-car-english/{z}/{x}/{y}{r}.png"),
"Cartago Light": L.tileLayer("http://localhost:8080/styles/cartago-light/{z}/{x}/{y}{r}.png"),
"Cartago Light English": L.tileLayer("http://localhost:8080/styles/cartago-light-english/{z}/{x}/{y}{r}.png"),
};
var layer = layers[localStorage.getItem("layer")];
map.addLayer(layer || layers["Cartago Streets"]);
map.addControl(L.control.layers(layers));
map.on("baselayerchange", e => localStorage.setItem("layer", e.name));
var hash = new L.Hash(map);
</script>
</body>
</html>