Created
December 4, 2019 08:32
-
-
Save kampar/7b29781ed6d6ccc213c4b03570d6c0b8 to your computer and use it in GitHub Desktop.
Morrowind Map with Leaflet JS with UESP tilelayer as it's bg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>UESP Leaflet</title> | |
<style> | |
html, body, #map{ | |
height: 100%; | |
margin: 0px; | |
padding: 0px | |
} | |
.leaflet-control-attribution { display:none!important} | |
</style> | |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" | |
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" | |
crossorigin=""/> | |
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" | |
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" | |
crossorigin=""></script> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
var map = L.map('map').setView( | |
{lat: 0, lng: 0} | |
, 2); | |
L.TileLayer.UESP = L.TileLayer.extend({ | |
getTileUrl: function(coords) { | |
//if((coords.z+8)<12) | |
if(coords.z<2) | |
return "https://maps.uesp.net/mwmap/zoom12/vvardenfell-0-2-12.jpg"; | |
//else | |
return "https://maps.uesp.net/mwmap/zoom" + (coords.z+10) + "/vvardenfell-" + (coords.x) + "-" + (coords.y) + "-" + (coords.z+10) + ".jpg"; | |
}, | |
getAttribution: function() { | |
return ""; | |
} | |
}); | |
L.tileLayer.uesp = function(o) { | |
return new L.TileLayer.UESP(o); | |
} | |
L.tileLayer.uesp({minZoom:2}).addTo(map); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment