{"name":"@mapbox/vector-tile","description":"Parses vector tiles","repository":{"url":"git+https://github.com/mapbox/vector-tile-js.git"},"version":"3.0.0","type":"module","exports":"./index.js","license":"BSD-3-Clause","main":"index.js","types":"index.d.ts","dependencies":{"@mapbox/point-geometry":"~1.1.0","@types/geojson":"^7946.0.16","pbf":"^5.0.0"},"devDependencies":{"benchmark":"^2.1.4","eslint":"^10.4.0","eslint-config-mourner":"^4.1.0","typescript":"^6.0.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"},"gitHead":"7606208872f1e4410ca262273ce7f991f85d9453","_id":"@mapbox/vector-tile@3.0.0","bugs":{"url":"https://github.com/mapbox/vector-tile-js/issues"},"homepage":"https://github.com/mapbox/vector-tile-js#readme","_nodeVersion":"24.16.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-Qf10S1uIHMk20ri/IVBnpS+esUEkVaR5Hftmz88jTInrpmWgPGJfPe3LVjjlE77trLx8tH6qjTG7uWH9hIq/0Q==","shasum":"71a75acb5ee20c20adca5c4e1ffb5ef95a56e351","tarball":"http://registry-npm.ywwl.com/@mapbox/vector-tile/download/@mapbox/vector-tile-3.0.0.tgz","fileCount":5,"unpackedSize":17650,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBoTW7QMI3qr633ojsDJa9dfDPZteNIbkWMl9Hb0MUp7AiEAwkgtkp8B7VYtVNgmdGAFndS929xl7rUkY92dCm3DiZc="}],"size":5008,"noattachment":false,"key":"/@mapbox/vector-tile/-/@mapbox/vector-tile-3.0.0.tgz"},"_npmUser":{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},"directories":{},"maintainers":[{"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"},{"name":"mbx-npm-ci-staging","email":"yannick.meeus+npm+staging+ci@mapbox.com"},{"name":"mbx-npm-ci-production","email":"yannick.meeus+npm+production+ci@mapbox.com"},{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},{"name":"mbx-npm-03-production","email":"yannick.meeus+npm+prod+03@mapbox.com"},{"name":"mbx-npm-04-production","email":"yannick.meeus+npm+prod+04@mapbox.com"},{"name":"mbx-npm-05-production","email":"yannick.meeus+npm+prod+05@mapbox.com"},{"name":"mbx-npm-06-production","email":"yannick.meeus+npm+prod+06@mapbox.com"},{"name":"mbx-npm-07-production","email":"yannick.meeus+npm+prod+07@mapbox.com"},{"name":"mbx-npm-08-production","email":"yannick.meeus+npm+prod+08@mapbox.com"},{"name":"mbx-npm-09-production","email":"yannick.meeus+npm+prod+09@mapbox.com"},{"name":"mbx-npm-02-staging","email":"yannick.meeus@mapbox.com"},{"name":"mbx-npm-advanced-actions-staging","email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com"},{"name":"mbx-npm-advanced-actions-production","email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vector-tile_3.0.0_1779868499029_0.5922502242142589"},"_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":1779868499178,"_cnpm_publish_time":1779868499178,"dist-tags":{"latest":"3.0.0"}}