-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
116 lines (102 loc) · 3.3 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
<!DOCTYPE html>
<html>
<head>
<title>Grid coordinates - Leaflet</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lacquer&family=Londrina+Shadow&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Source+Sans+3:ital,wght@0,300;0,700;1,300&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="crossorigin=""></script>
<style>
html, body { height: 100%; margin: 0; }
#map {
float: left;
width: 100vw;
height: 100vh;
}
.leaflet-container { background: #CCFFFF; }
p {
font-family: "Chakra Petch", serif;
font-weight: 400;
font-style: normal;
font-size: 1.2em;
color: #CCFFFF;
background-color: rgba(51, 0, 102, 0.5);
}
.title {
position: absolute;
bottom: 0;
margin: 10px;
padding: 10px;
left: 0;
z-index: 999;
}
</style>
</head>
<body>
<div class="box">
<p class="title">Ship: Henry_B._Bigelow, Cruise: HB0707</p>
</div>
<div id="maps">
<div id='map' class="map"></div>
</div>
<script type="text/javascript">
//var tileURL = 'https://hb0707.s3.us-east-1.amazonaws.com/with_bottom/tiles/{z}_{x}_{y}.png';
var tileURL = './w/tiles/{z}_{x}_{y}.png';
var tileURL2 = './wo/tiles/{z}_{x}_{y}.png';
var w = 131072; // this is the size of largest buffered image, 8.png
var h = 8192; //8192;
var mapMinZoom = 0;
var mapMaxZoom = 8;
var tileLayer = L.tileLayer(
tileURL, {
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
continuousWorld: true,
noWrap: true,
tileSize: 512,
crs: L.CRS.Simple,
});
var tileLayer2 = L.tileLayer(
tileURL2, {
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
continuousWorld: true,
noWrap: true,
tileSize: 512,
crs: L.CRS.Simple,
});
var map = L.map('map', {
crs: L.CRS.Simple,
center: [0, 0],
zoom: 1,
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
layers: [tileLayer, tileLayer2],
attributionControl: false,
});
// Problem here probably because tiles are not perfectly square
var mapBounds = new L.LatLngBounds(
map.unproject([0, h], mapMaxZoom), // bottom-left
map.unproject([w, 0], mapMaxZoom), // top-right
);
map.setMaxBounds(mapBounds);
const baseLayers = {
'With Sub Bottom': tileLayer,
'Without Sub Bottom': tileLayer2,
};
const layerControl = L.control.layers(baseLayers).addTo(map);
map.addEventListener('mouseup', function(ev) {
yy = ev.latlng.lat;
xx = ev.latlng.lng;
console.log('xx: ' + String(xx) + ', yy: ' + String(yy));
});
</script>
</body>
</html>