Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<title>Laserkarta Gbg Norr</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<script src=""></script>
<script src=""></script>
html, body, #map { width:100%; height:100%; margin:0; padding:0; z-index: 1; background: #ffffff; }
#slider{ position: absolute; top: 10px; right: 10px; z-index: 5; }
<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 = [287766,6394692,347415,6425590];
var mapMinZoom = 3;
var mapMaxZoom = 9;
var mapMaxResolution = 1.00000000;
var mapMinResolution = Math.pow(2, mapMaxZoom) * mapMaxResolution;
var tileExtent = [287766,6394692,347415,6425590];
var crs = new L.Proj.CRS('EPSG:3006',
'+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
// bounds: L.bounds([[mapExtent[0], mapExtent[1]], [mapExtent[2], mapExtent[3]]]),
origin: [mapExtent[0], mapExtent[3]],
resolutions: [512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25, 0.125]
var layer;
var map = new L.Map('map', {
maxZoom: mapMaxZoom,
minZoom: 0,
crs: crs
layer = L.tileLayer('{z}/{y}/{x}.png', {
minZoom: mapMinZoom, maxZoom: mapMaxZoom,
attribution: '<table><tr><td>Cereated with : <a href="">OCAD AG</a><br>Read usage <a href=licens.html>license on seperate page</a><br>Individuals free, clubs and companies <br>under licens</td><td><a href=><img width=75 src=></a></td></tr></table>',
noWrap: true,
tms: false
crs.unproject(L.point(mapExtent[2], mapExtent[3])),
crs.unproject(L.point(mapExtent[0], mapExtent[1]))
function offsetScale(z) {
return Math.pow(2, 13 - (z + zoomOffset))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment