Commit 7cfb6391 authored by Vladimir Agafonkin's avatar Vladimir Agafonkin
Browse files

do not tile empty geojson, close #40

parent 76140fe4
......@@ -36,10 +36,10 @@ function GeoJSONVT(data, options) {
features = wrap(features, options.buffer / options.extent, intersectX);
// start slicing from the top tile down
this.splitTile(features, 0, 0, 0);
if (features.length) this.splitTile(features, 0, 0, 0);
if (debug) {
console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);
if (features.length) console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);
console.timeEnd('generate tiles');
console.log('tiles generated:', this.total, JSON.stringify(this.stats));
}
......
{
"type": "FeatureCollection",
"features": []
}
......@@ -24,6 +24,11 @@ function testTiles(inputFile, expectedFile, maxZoom, maxPoints) {
});
}
test('empty geojson', function (t) {
t.same(genTiles(getJSON('empty.json')), {});
t.end();
});
function getJSON(name) {
return JSON.parse(fs.readFileSync(path.join(__dirname, '/fixtures/' + name)));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment