Skip to content

Instantly share code, notes, and snippets.

@ch3ll0v3k
Created November 18, 2019 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ch3ll0v3k/32ee3c93e79234ed720fda217e55547c to your computer and use it in GitHub Desktop.
Save ch3ll0v3k/32ee3c93e79234ed720fda217e55547c to your computer and use it in GitHub Desktop.
function getTileUrls(bounds, tileLayer, zoom) {
var min = map.project(bounds.getNorthWest(), zoom).divideBy(256).floor(),
max = map.project(bounds.getSouthEast(), zoom).divideBy(256).floor(),
urls = [];
for (var i = min.x; i <= max.x; i++) {
for (var j = min.y; j <= max.y; j++) {
var coords = new L.Point(i, j);
coords.z = zoom;
urls.push(tileLayer.getTileUrl(coords));
}
}
return urls;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment