Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function(layers) {
var pbfOptions = {};
for(var i in layers) {
var layer = layers[i];
if(layer.pbf){
//construct the GeoJSONWrapper here, so that we can tell him the version !
pbfOptions[layer.name] = new GeoJSONWrapper(layer.pbf.features);
pbfOptions[layer.name].name = layer.name;
pbfOptions[layer.name].version = 2;
}
}
if(pbfOptions.length === 0) {
return undefined;
}
// we use fromVectorTileJs instead of fromGeojsonVt because we constructed the GeoJSONWrapper ourselves
var buff = vtpbf.fromVectorTileJs({layers: pbfOptions});
if(buff) {
buff = new Buffer(buff.buffer);
}
return buff;
});
};