Takes optimized filter object from shaver.styleToFilters and returns c++ filters for shave.
Parameters
filters
Object the filter object from theshaver.styleToFilters
Examples
var shaver = require('@mapbox/vtshaver');
var style = require('/path/to/style.json');
// get the filters object from `styleToFilters`
var styleFilters = shaver.styleToFilters(style);
// call the function to create filters
var filters = new shaver.Filters(styleFilters);
Shave off unneeded layers and features, asynchronously
Parameters
buffer
Buffer Vector Tile PBFoptions
Object (optional, default{}
)callback
Function from whence the shaven vector tile comes
Examples
var shaver = require('@mapbox/vtshaver');
var fs = require('fs');
var buffer = fs.readFileSync('/path/to/vector-tile.mvt');
var style = require('/path/to/style.json');
var filters = new shaver.Filters(shaver.styleToFilters(style));
var options = {
filters: filters, // required
zoom: 14, // required
maxzoom: 16, // optional
compress: { // optional
type: 'none'
}
};
shaver.shave(buffer, options, function(err, shavedTile) {
if (err) throw err;
console.log(shavedTile); // => vector tile buffer
});