cached-vector-tile
An alternative implementation of the [vector-tile-js](https://github.com/mapbox/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(
Last updated 4 years ago by anandthakker .
ISC · Original npm · Tarball · package.json
$ cnpm install cached-vector-tile 
SYNC missed versions from official npm registry.

cached-vector-tile CircleCI

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

var Protobuf = require('pbf');
var VectorTile = require('vector-tile').VectorTile
var CachedVectorTile = require('cached-vector-tile')

var vt = new VectorTile(new Protobuf(rawdata))

var cached = new CachedVectorTile(vt)

var plain = 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).

Parameters

  • vt (VectorTile | CachedVectorTile | object) The vector tile to clone. Can be a vector-tile-js tile, a CachedVectorTile, or a plain JS object as serialized by CachedVectorTile#serialize
  • 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.

CachedVectorTileLayer

A vector tile layer. Implements the interface defined in the vector-tile-js API reference

serialize

Returns a plain JS object representation of the vector tile layer.

CachedVectorTileFeature

A vector tile feature. Implements the interface defined in the vector-tile-js API reference.

serialize

Returns a plain JS object representation of the vector tile feature.

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

2 Versions

  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |