Files
CM95/web/index.html

68 lines
1.4 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>CM95 PBF Test</title>
<link href="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.js"></script>
<style>
html, body, #map {
width: 100%;
height: 100%;
margin: 0;
}
#info {
position: absolute;
left: 10px;
top: 10px;
z-index: 10;
padding: 6px 9px;
background: rgba(255,255,255,.90);
border-radius: 4px;
font: 12px/1.4 sans-serif;
}
</style>
</head>
<body>
<div id="map"></div>
<div id="info">
CM95 v1.4.5<br />
<span id="pos"></span>
</div>
<script>
const map = new maplibregl.Map({
container: "map",
style: "./style.json",
center: [135.0, 35.0],
zoom: 5,
hash: true
});
map.addControl(
new maplibregl.NavigationControl(),
"top-right"
);
const pos = document.getElementById("pos");
function update() {
const c = map.getCenter();
pos.textContent =
`z=${map.getZoom().toFixed(2)} ` +
`${c.lng.toFixed(5)}, ${c.lat.toFixed(5)}`;
}
map.on("load", update);
map.on("move", update);
map.on("error", e => console.error("MapLibre:", e.error || e));
</script>
</body>
</html>