-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (45 loc) · 1.35 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
<head>
<title>Sonic Fiber</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
</head>
<body style='margin: 0'>
<div id='map' style='width: 100%; height: 100%'></div>
</body>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="wicket.js"></script>
<script src="wicket-leaflet.js"></script>
<script>
var map = L.map('map', {
center: [37.77, -122.45],
zoom: 13
});
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, © <a href="https://carto.com/attribution">CARTO</a>'
}).addTo(map);
var xhr = new XMLHttpRequest();
xhr.open('GET', 'sonic_fiber.wkt', true);
xhr.onload = function() {
var lines = this.response.split('\n');
for (var i=0, l=lines.length; i<l; i++) {
if (lines[i]) {
var wkt = new Wkt.Wkt(lines[i]);
wkt.toObject().addTo(map);
}
}
};
xhr.send()
/*
//Fetch API
window.fetch('sonic_fiber.wkt').then(function(response) {
response.text().then(function(text) {
var lines = text.split('\n');
for (var i=0, l=lines.length; i<l; i++) {
var wkt = new Wkt.Wkt(lines[i]);
wkt.toObject().addTo(map);
}
});
});
*/
</script>