You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB
JavaScript

var mymap = L.map('mapid', {
maxZoom: 10,
minZoom: 10,
zoom: 0,
crs: L.CRS.Simple,
center: new L.LatLng(-100,300),
}); //.setView([0, 0], 25);
// L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
// attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
// maxZoom: 100,
// id: 'mapbox.streets',
// accessToken: 'your.mapbox.access.token'
// }).addTo(mymap);
L.GridLayer.DebugCoords = L.GridLayer.extend({
createTile: function (coords) {
var tile = document.createElement('p');
// var tileSize = this.getTileSize();
tile.setAttribute('width', '10px !important');
tile.setAttribute('height', '10px !important');
var openpop = false;
setTimeout(function () {
done(null, tile); // Syntax is 'done(error, tile)'
}, 500 + Math.random() * 1500);
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
tile.innerHTML = '<p style="width:200px;">'+ text2[getRandomInt(17)] + '</p>' ;
return tile;
}
});
function closeOpen(){
}
L.gridLayer.debugCoords = function(opts) {
return new L.GridLayer.DebugCoords(opts);
};
mymap.addLayer( L.gridLayer.debugCoords() );