mirror of
https://github.com/ddv2005/AirsoftTracker.git
synced 2025-07-27 15:19:32 +00:00
71 lines
2.5 KiB
HTML
71 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>tiles</title>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="imagetoolbar" content="no"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<style type="text/css">
|
|
html, body { margin:0; padding: 0; height: 100%; width: 100%; }
|
|
body { width:100%; height:100%; background: #ffffff; }
|
|
#map { position: absolute; height: 100%; width: 100%; background-color: #FFFFFF; }
|
|
#slider { position: absolute; top: 30px; right: 10px; }
|
|
</style>
|
|
<link rel="stylesheet" href="https://cdn.maptiler.com/ol/v5.3.0/ol.css" type="text/css">
|
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL,fetch,Function.prototype.bind,es5&flags=always,gated&unknown=polyfill" type="text/javascript"></script>
|
|
<script src="https://cdn.maptiler.com/ol/v5.3.0/ol.js" type="text/javascript"></script>
|
|
</head>
|
|
<body>
|
|
<div id="map"></div>
|
|
<input id="slider" type="range" min="0" max="1" step="0.1" value="1" oninput="layer.setOpacity(this.value)">
|
|
<script type="text/javascript">
|
|
var mapExtent = [-8340140.79320000, 4827393.46432224, -8339268.82140956, 4828367.83280000];
|
|
var mapMinZoom = 1;
|
|
var mapMaxZoom = 3;
|
|
var mapMaxResolution = 0.50000000;
|
|
var tileExtent = [-8340140.79320000, 4827393.46432224, -8339268.82140956, 4828367.83280000];
|
|
// Proj4js definition (verify code at http://epsg.io/3857);
|
|
// proj4.defs('EPSG:3857', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs');
|
|
var tileWidth = 240;
|
|
var tileHeight = 240;
|
|
|
|
var mapResolutions = [];
|
|
for (var z = 0; z <= mapMaxZoom; z++) {
|
|
mapResolutions.push(Math.pow(2, mapMaxZoom - z) * mapMaxResolution);
|
|
}
|
|
|
|
var mapTileGrid = new ol.tilegrid.TileGrid({
|
|
tileSize: [tileWidth, tileHeight],
|
|
extent: tileExtent,
|
|
minZoom: mapMinZoom,
|
|
resolutions: mapResolutions
|
|
});
|
|
|
|
var layer = new ol.layer.Tile({
|
|
source: new ol.source.XYZ({
|
|
attributions: 'Rendered with <a href="https://www.maptiler.com/desktop/">MapTiler Desktop</a>',
|
|
projection: 'EPSG:3857',
|
|
tileGrid: mapTileGrid,
|
|
tilePixelRatio: 1.00000000,
|
|
url: "{z}/{x}/{y}.png",
|
|
})
|
|
});
|
|
|
|
var map = new ol.Map({
|
|
target: 'map',
|
|
layers: [
|
|
layer,
|
|
],
|
|
view: new ol.View({
|
|
projection: ol.proj.get('EPSG:3857'),
|
|
extent: mapExtent,
|
|
maxResolution: mapTileGrid.getResolution(mapMinZoom)
|
|
})
|
|
});
|
|
map.getView().fit(mapExtent, map.getSize());
|
|
map.addControl(new ol.control.MousePosition());
|
|
</script>
|
|
</body>
|
|
</html>
|