{"name":"@mapbox/vector-tile","description":"Parses vector tiles","repository":{"url":"git+https://github.com/mapbox/vector-tile-js.git"},"version":"2.0.1","type":"module","exports":"./index.js","license":"BSD-3-Clause","main":"index.js","types":"index.d.ts","dependencies":{"@mapbox/point-geometry":"~1.0.0","@types/geojson":"^7946.0.14","pbf":"^4.0.1"},"devDependencies":{"benchmark":"^2.1.4","eslint":"^9.6.0","eslint-config-mourner":"^4.0.2","typescript":"^5.5.3"},"scripts":{"lint":"eslint index.js test/*.js","pretest":"npm run lint","test":"tsc && node --test","cov":"node --test --experimental-test-coverage","prepublishOnly":"npm test"},"_id":"@mapbox/vector-tile@2.0.1","gitHead":"a37312e2112190c6f9c070d084e509895878f02e","bugs":{"url":"https://github.com/mapbox/vector-tile-js/issues"},"homepage":"https://github.com/mapbox/vector-tile-js#readme","_nodeVersion":"20.12.1","_npmVersion":"10.5.1","dist":{"integrity":"sha512-sHjD7RWxfaGpwUgjS1vxfvu+w06haJZKjN1XYHBKm3w/pM3xVSGrmtxLVgNsotjDILmFS4hEjWiA3Rl/tw5egw==","shasum":"7c4f3333302b666dc3b12690bf08995027062018","tarball":"http://registry-npm.ywwl.com/@mapbox/vector-tile/download/@mapbox/vector-tile-2.0.1.tgz","fileCount":5,"unpackedSize":16422,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjaaJaZiVEnXG+wbCtYI5yqILt/xnIzewDQFo019h+zQIhAK0P6O2Un63WFNJIDU7OtOIeiMW05lPEgCyEMrhKeeWx"}],"size":4922,"noattachment":false,"key":"/@mapbox/vector-tile/-/@mapbox/vector-tile-2.0.1.tgz"},"_npmUser":{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},"directories":{},"maintainers":[{"name":"mbx-npm-ci-production","email":"yannick.meeus+npm+production+ci@mapbox.com"},{"name":"mbx-npm-ci-staging","email":"yannick.meeus+npm+staging+ci@mapbox.com"},{"name":"mbx-npm-advanced-actions-production","email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com"},{"name":"mbx-npm-advanced-actions-staging","email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com"},{"name":"mbx-npm-09-production","email":"yannick.meeus+npm+prod+09@mapbox.com"},{"name":"mbx-npm-08-production","email":"yannick.meeus+npm+prod+08@mapbox.com"},{"name":"mbx-npm-07-production","email":"yannick.meeus+npm+prod+07@mapbox.com"},{"name":"mbx-npm-06-production","email":"yannick.meeus+npm+prod+06@mapbox.com"},{"name":"mbx-npm-05-production","email":"yannick.meeus+npm+prod+05@mapbox.com"},{"name":"mbx-npm-04-production","email":"yannick.meeus+npm+prod+04@mapbox.com"},{"name":"mbx-npm-03-production","email":"yannick.meeus+npm+prod+03@mapbox.com"},{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},{"name":"mbx-npm-02-staging","email":"yannick.meeus@mapbox.com"},{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},{"name":"mapbox-npm-07","email":"accounts+npmjs-07@mapbox.com"},{"name":"mapbox-npm-03","email":"accounts+npmjs-03@mapbox.com"},{"name":"mapbox-npm-04","email":"accounts+npmjs-04@mapbox.com"},{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},{"name":"mapbox-npm-05","email":"accounts+npmjs-05@mapbox.com"},{"name":"mapbox-npm-06","email":"accounts+npmjs-06@mapbox.com"},{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},{"name":"mapbox-npm-advanced-actions","email":"accounts+npmjs-advanced-actions@mapbox.com"},{"name":"mapbox-npm-ci","email":"accounts+npmjs-npm-ci@mapbox.com"},{"name":"mapbox-npm","email":"accounts+npmjs@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vector-tile_2.0.1_1720692835645_0.44242591670751574"},"_hasShrinkwrap":false,"readme":"# vector-tile\n\nThis library reads [Mapbox Vector Tiles](https://github.com/mapbox/vector-tile-spec) and allows access to the layers and features.\n\n## Example\n\n```js\nimport {VectorTile} from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\n\nconst tile = new VectorTile(new Protobuf(data));\n\n// Contains a map of all layers\ntile.layers;\n\nconst landuse = tile.layers.landuse;\n\n// Amount of features in this layer\nlanduse.length;\n\n// Returns the first feature\nlanduse.feature(0);\n```\n\nVector tiles contained in [serialtiles-spec](https://github.com/mapbox/serialtiles-spec)\nare gzip-encoded, so a complete example of parsing them with the native\nzlib module would be:\n\n```js\nimport {VectorTile} from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\nimport {gunzipSync} from 'zlib';\n\nconst buffer = gunzipSync(data);\nconst tile = new VectorTile(new Protobuf(buffer));\n```\n\n## Install\n\nTo install:\n\n    npm install @mapbox/vector-tile\n\n\n## API Reference\n\n### VectorTile\n\nAn object that parses vector tile data and makes it readable.\n\n#### Constructor\n\n- **new VectorTile(protobuf[, end])** &mdash;\n  parses the vector tile data contained in the given [Protobuf](https://github.com/mapbox/pbf) object,\n  saving resulting layers in the created object as a `layers` property. Optionally accepts end index.\n\n#### Properties\n\n- **layers** (Object) &mdash; an object containing parsed layers in the form of `{<name>: <layer>, ...}`,\nwhere each layer is a `VectorTileLayer` object.\n\n\n### VectorTileLayer\n\nAn object that contains the data for a single vector tile layer.\n\n#### Properties\n\n- **version** (`Number`, default: `1`)\n- **name** (`String`) &mdash; layer name\n- **extent** (`Number`, default: `4096`) &mdash; tile extent size\n- **length** (`Number`) &mdash; number of features in the layer\n\n#### Methods\n\n- **feature(i)** &mdash; get a feature (`VectorTileFeature`) by the given index from the layer.\n\n\n### VectorTileFeature\n\nAn object that contains the data for a single feature.\n\n#### Properties\n\n- **type** (`Number`) &mdash; type of the feature (also see `VectorTileFeature.types`)\n- **extent** (`Number`) &mdash; feature extent size\n- **id** (`Number`) &mdash; feature identifier, if present\n- **properties** (`Object`) &mdash; object literal with feature properties\n\n#### Methods\n\n- **loadGeometry()** &mdash; parses feature geometry and returns an array of\n  [Point](https://github.com/mapbox/point-geometry) arrays (with each point having `x` and `y` properties)\n- **bbox()** &mdash; calculates and returns the bounding box of the feature in the form `[x1, y1, x2, y2]`\n- **toGeoJSON(x, y, z)** &mdash; returns a GeoJSON representation of the feature. (`x`, `y`, and `z` refer to the containing tile's index.)\n","publish_time":1720692835826,"_cnpm_publish_time":1720692835826,"dist-tags":{"latest":"3.0.0"}}