Leaflet/docs/examples/extending/gridcoords.md
Iván Sánchez Ortega d40d82a226 Docs: Add the plugin tutorials from #4356 (#4854)
* Docs: Add the plugin tutorials from #4356

* Include ImageOverlay in class diagram
2016-10-07 16:45:02 +02:00

33 lines
682 B
Markdown

---
layout: tutorial_frame
title: Grid coordinates
---
<script type='text/javascript'>
var map = L.map('map', {
center: [0, 0],
zoom: 0
});
L.GridLayer.DebugCoords = L.GridLayer.extend({
createTile: function (coords, done) {
var tile = document.createElement('div');
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.outline = '1px solid red';
setTimeout(function () {
done(null, tile); // Syntax is 'done(error, tile)'
}, 500 + Math.random() * 1500);
return tile;
}
});
L.gridLayer.debugCoords = function(opts) {
return new L.GridLayer.DebugCoords(opts);
};
map.addLayer( L.gridLayer.debugCoords() );
</script>