Usage:
npm i @mapbox/vector-tile
node count-features-in-tile.js tile.pbf| const fs = require("fs"); | |
| const Protobuf = require("pbf"); | |
| const VectorTile = require("@mapbox/vector-tile").VectorTile; | |
| const args = process.argv.slice(2); | |
| const data = fs.readFileSync(args[0]); | |
| const tile = new VectorTile(new Protobuf(data)); | |
| const layers = tile.layers; | |
| Object.keys(layers).forEach(layerId => { | |
| const layer = layers[layerId]; | |
| console.log(layerId, layer.length); | |
| }); |