Skip to content

Commit

Permalink
Save empty tiles at the bottom of the pyramid, per mapbox/geojson-vt-…
Browse files Browse the repository at this point in the history
  • Loading branch information
yhahn authored and mourner committed Jun 26, 2016
1 parent 5bd55d7 commit 5368e63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Expand Up @@ -147,10 +147,12 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) {

if (debug > 1) console.timeEnd('clipping');

if (tl) stack.push(tl, z + 1, x * 2, y * 2);
if (bl) stack.push(bl, z + 1, x * 2, y * 2 + 1);
if (tr) stack.push(tr, z + 1, x * 2 + 1, y * 2);
if (br) stack.push(br, z + 1, x * 2 + 1, y * 2 + 1);
if (features.length) {
stack.push(tl || [], z + 1, x * 2, y * 2);
stack.push(bl || [], z + 1, x * 2, y * 2 + 1);
stack.push(tr || [], z + 1, x * 2 + 1, y * 2);
stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);
}
}

return solid;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/us-states-tiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/test-get-tile.js
Expand Up @@ -27,7 +27,7 @@ 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.equal(index.total, 37);

t.end();
});
Expand Down

0 comments on commit 5368e63

Please sign in to comment.