Skip to content

Commit

Permalink
fix a bug that led to lots of unnecessary tiles generated on getTile
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Sep 22, 2015
1 parent 7cfb639 commit 53ecc21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) {

// stop tiling if it's not an ancestor of the target tile
var m = 1 << (cz - z);
if (x !== Math.floor(cx / m) && y !== Math.floor(cy / m)) continue;
if (x !== Math.floor(cx / m) || y !== Math.floor(cy / m)) continue;
}

// if we slice further down, no need to keep source geometry
Expand Down
2 changes: 2 additions & 0 deletions test/test-get-tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ test('getTile: us-states.json', function (t) {
t.equal(index.getTile(11, 800, 400), null, 'non-existing tile');
t.equal(index.getTile(-5, 123.25, 400.25), null, 'invalid tile');

t.equal(index.total, 29);

t.end();
});

Expand Down

0 comments on commit 53ecc21

Please sign in to comment.