- Posts: 41
- Thank you received: 0
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
function(coords) {
var tile = L.DomUtil.create('canvas', 'leaflet-tile');
var ctx = tile.getContext('2d');
var size = this.getTileSize()
tile.width = size.x
tile.height = size.y
// calculate projection coordinates of top left tile pixel
var nwPoint = coords.scaleBy(size)
// calculate geographic coordinates of top left tile pixel
var nw = map.unproject(nwPoint, coords.z)
// will not create white background
//ctx.fillStyle = 'white';
//ctx.fillRect(0, 0, size.x, 50);
//ctx.fillStyle = 'black';
var vx = " " + coords.x;
var vy = " " + coords.y;
ctx.fillText('x:' + vx + ', y:' + vy + ', zoom: ' + coords.z, 20, 20);
vx = " " + parseFloat(nw.lat.toFixed(7));
vy = " " + parseFloat(nw.lng.toFixed(7));
ctx.fillText('lat:' + vx + ', lon:' + vy, 20, 40);
ctx.strokeStyle = 'black';
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(size.x, 0);
ctx.lineTo(size.x, size.y);
ctx.lineTo(0, size.y);
ctx.closePath();
ctx.stroke();
return tile;
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
© 2011- Жук Це-Це. Design by Dmitry Zhuk