@mapbox/vector-tile - npm
文章推薦指數: 80 %
@mapbox/vector-tile. 1.3.1 • Public • Published 4 years ago. Readme · Explore BETA · 1 Dependency · 154 Dependents · 6 Versions ...
@mapbox/vector-tile1.3.1 • Public • Published4yearsagoReadmeExploreBETA1Dependency154Dependents6Versionsvector-tile
ThislibraryreadsMapboxVectorTilesandallowsaccesstothelayersandfeatures.
Example
var VectorTile = require('@mapbox/vector-tile').VectorTile;var Protobuf = require('pbf'); var tile = new VectorTile(new Protobuf(data)); // Contains a map of all layerstile.layers; var landuse = tile.layers.landuse; // Amount of features in this layerlanduse.length; // Returns the first featurelanduse.feature(0);
Vectortilescontainedinserialtiles-spec
aregzip-encoded,soacompleteexampleofparsingthemwiththenative
zlibmodulewouldbe:
var VectorTile = require('vector-tile').VectorTile;var Protobuf = require('pbf');var zlib = require('zlib'); zlib.gunzip(data, function(err, buffer) { var tile = new VectorTile(new Protobuf(buffer));});
Depends
Node.jsv0.10.xorv0.8.x
Install
Toinstall:
npminstall@mapbox/vector-tile
APIReference
VectorTile
Anobjectthatparsesvectortiledataandmakesitreadable.
Constructor
newVectorTile(protobuf[,end])—
parsesthevectortiledatacontainedinthegivenProtobufobject,
savingresultinglayersinthecreatedobjectasalayersproperty.Optionallyacceptsendindex.
Properties
layers(Object)—anobjectcontainingparsedlayersintheformof{
延伸文章資訊
- 1Reference | Vector tiles - Docs Mapbox
Vector tiles make huge maps fast while offering full design flexibility. The vector tile format i...
- 2Vector tiles - Wikipedia
- 3Unlimited private tilesets available for all users - Mapbox blog
- 4mapbox/vector-tile-js - GitHub
Parses vector tiles with JavaScript. Contribute to mapbox/vector-tile-js development by creating ...
- 5Vector tiles - Wikipedia
Protocol buffers (Mapbox)