mapbox/vector-tile-js - GitHub

文章推薦指數: 80 %
投票人數:10人

Parses vector tiles with JavaScript. Contribute to mapbox/vector-tile-js development by creating an account on GitHub. Skiptocontent {{message}} mapbox / vector-tile-js Public Notifications Star 268 Fork 69 ParsesvectortileswithJavaScript BSD-3-ClauseLicense 268 stars 69 forks Star Notifications Code Issues 10 Pullrequests 7 Projects 0 Wiki Security Insights More Code Issues Pullrequests Projects Wiki Security Insights master Branches Tags Couldnotloadbranches Nothingtoshow Loading {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default Loading 8 branches 14 tags Code Loading Latestcommit   Gitstats 93 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime lib     proto     test     .eslintrc     .gitignore     .travis.yml     CHANGELOG.md     LICENSE.txt     README.md     fixtures.js     index.js     package.json     Viewcode vector-tile Example Depends Install APIReference VectorTile Constructor Properties VectorTileLayer Properties Methods VectorTileFeature Properties Methods README.md vector-tile ThislibraryreadsMapboxVectorTilesandallowsaccesstothelayersandfeatures. Example varVectorTile=require('@mapbox/vector-tile').VectorTile; varProtobuf=require('pbf'); vartile=newVectorTile(newProtobuf(data)); //Containsamapofalllayers tile.layers; varlanduse=tile.layers.landuse; //Amountoffeaturesinthislayer landuse.length; //Returnsthefirstfeature landuse.feature(0); Vectortilescontainedinserialtiles-spec aregzip-encoded,soacompleteexampleofparsingthemwiththenative zlibmodulewouldbe: varVectorTile=require('vector-tile').VectorTile; varProtobuf=require('pbf'); varzlib=require('zlib'); zlib.gunzip(data,function(err,buffer){ vartile=newVectorTile(newProtobuf(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{:,...}, whereeachlayerisaVectorTileLayerobject. VectorTileLayer Anobjectthatcontainsthedataforasinglevectortilelayer. Properties version(Number,default:1) name(String)—layername extent(Number,default:4096)—tileextentsize length(Number)—numberoffeaturesinthelayer Methods feature(i)—getafeature(VectorTileFeature)bythegivenindexfromthelayer. VectorTileFeature Anobjectthatcontainsthedataforasinglefeature. Properties type(Number)—typeofthefeature(alsoseeVectorTileFeature.types) extent(Number)—featureextentsize id(Number)—featureidentifier,ifpresent properties(Object)—objectliteralwithfeatureproperties Methods loadGeometry()—parsesfeaturegeometryandreturnsanarrayof Pointarrays(witheachpointhavingxandyproperties) bbox()—calculatesandreturnstheboundingboxofthefeatureintheform[x1,y1,x2,y2] toGeoJSON(x,y,z)—returnsaGeoJSONrepresentationofthefeature.(x,y,andzrefertothecontainingtile'sindex.) About ParsesvectortileswithJavaScript Resources Readme License BSD-3-ClauseLicense Releases 14 tags Packages0 Nopackagespublished Usedby25k +25,034 Contributors14 +3contributors Languages JavaScript 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?