// assume you can read (.pbf | .mvt | .ovt) constfixture = fs.readFileSync('./x-y-z.vector.pbf'); // Or load with bun: constfixture = awaitBun.file('./x-y-z.vector.pbf').arrayBuffer(); // load the protobuf parsing it directly consttile = newVectorTile(fixture);
// VECTOR API:
// example layer const { landuse } = tile.layers;
// grab the first feature constfirstFeature = landuse.feature(0); // grab the geometry constgeometry = firstFeature.loadGeometry(); // OR specifically ask for a geometry type constpoints = firstFeature.loadPoints(); constlines = firstFeature.loadLines(); constpolys = firstFeature.loadPolys();
// If you want to take advantage of the pre-tessellated and indexed geometries // and you're loading the data for a renderer, you can grab the pre-tessellated geometry const [flatGeometry, indices] = firstFeature.loadGeometryFlat();
// IMAGE API
// example layer const { satellite } = tile.images; // grab the image data constdata = satellite.image(); // Uint8Array
// GRIDDED API
// example layer const { elevation } = tile.grids; // grab the grid data constdata = elevation.grid(); // number[]
Open Vector Tile
Description
A Vector Tile may parse either Mapbox or OpenVector Tile Layers The input is a Uint8Array that has encoded protobuffer messages.
Types of layers include:
Usage