You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An alternative implementation of the vector-tile-js interface that is backed by plain JS objects/arrays rather than parsed-on-demand protobuf data. Trades away memory efficiency for faster feature.loadGeometry() calls.
Install and Use
npm install cached-vector-tile
varProtobuf=require('pbf');varVectorTile=require('vector-tile').VectorTilevarCachedVectorTile=require('cached-vector-tile')varvt=newVectorTile(newProtobuf(rawdata))varcached=newCachedVectorTile(vt)varplain=cached.serialize()// 'plain' is a plain JS object, suitable for JSON.serialize() or storage in// something like IndexedDB
API
CachedVectorTile
A vector tile. Implements the interface defined in the vector-tile-js API reference (except that the constructor is different).
properties[object] An optional object mapping feature ids to property values. If provided, these properties will be used instead of the ones present in vt's features.
serialize
Returns a plain JS object representation of the vector tile.