-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getAllChildren #26
Comments
I think this would do the same thing as this proposal: #19 |
I believe the idea behind If I don't lose my mind in recursion that is. |
Ah, that's right. I think the same method should work. We should probably have a note about performance in the docs on this. Performance and memory use can quickly get out of hand with a tile pyramid. |
var tilebelt = require('tilebelt');
function getAllChildren(tile, maxZoom) {
if (tile[2] >= maxZoom) return [tile];
var zoomDiff = maxZoom - tile[2];
var allChildren = [];
theChildren(tile);
return allChildren;
function theChildren(tile) {
var children = tilebelt.getChildren(tile);
allChildren = allChildren.concat(children);
if (children[0][2] === maxZoom) return;
children.forEach(theChildren);
}
}
console.log(getAllChildren([18,24,6], 14)); Here's what I did, it works and I'm using it in a project but it's probably not performant enough to include in tilebelt. |
I need to invalidate a tile and get all the children below it that need to be regenerated.
I'm thinking something like this:
tilebelt.getAllChildren(tile, maxZoom)
tilebelt.getAllChildren([18, 24, 6], 14)
The text was updated successfully, but these errors were encountered: