Skip to content

Commit

Permalink
Workaround for mapnik-vector-tile bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Jun 15, 2015
1 parent 3263ad9 commit a615643
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/vectortilefeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ VectorTileFeature.prototype.loadGeometry = function() {
line.push(new Point(x, y));

} else if (cmd === 7) {
line.push(line[0].clone()); // closePolygon

// Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
if (line) {
line.push(line[0].clone()); // closePolygon
}

} else {
throw new Error('unknown command ' + cmd);
Expand Down
Binary file added test/fixtures/12-1143-1497.vector.pbf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,10 @@ test('https://github.com/mapbox/vector-tile-js/issues/15', function(t) {
t.ok(tile.layers["stuttgart-rails"].feature(0));
t.end();
});

test('https://github.com/mapbox/mapbox-gl-js/issues/1019', function(t) {
var data = fs.readFileSync(__dirname + '/fixtures/12-1143-1497.vector.pbf');
var tile = new VectorTile(new Protobuf(data));
t.ok(tile.layers["water"].feature(1).loadGeometry());
t.end();
});

0 comments on commit a615643

Please sign in to comment.