{"name":"@maplibre/vt-pbf","version":"4.2.0","author":{"url":"http://anandthakker.net/","name":"Anand Thakker","email":"vestibule@anandthakker.net"},"license":"MIT","_id":"@maplibre/vt-pbf@4.2.0","maintainers":[{"name":"maplibreorg","email":"board@maplibre.org"},{"name":"harelmazor","email":"harel.mazor@gmail.com"},{"name":"birkskyum","email":"birk.skyum@pm.me"},{"name":"mwilsnd","email":"mwilsnd@gmail.com"}],"homepage":"https://github.com/maplibre/vt-pbf#readme","bugs":{"url":"https://github.com/maplibre/vt-pbf/issues"},"dist":{"shasum":"403c6f8cfbc1e3730cbd3ff3d829bfb484403cd4","tarball":"http://registry-npm.ywwl.com/@maplibre/vt-pbf/download/@maplibre/vt-pbf-4.2.0.tgz","fileCount":10,"integrity":"sha512-bxrk/kQUwWXZgmqYgwOCnZCMONCRi3MJMqJdza4T3E4AeR5i+VyMnaJ8iDWtWxdfEAJRtrzIOeJtxZSy5mFrFA==","signatures":[{"sig":"MEQCIDHHWKUUqvR7TdIR+S29+3V703hRu8TtvDYYJ/t3OA/2AiAthlcuspu7S8PN+Y+Y/T9G4VCIUO0r6LOhsy6KP5o5Gg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@maplibre%2fvt-pbf@4.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":25263,"size":8703,"noattachment":false,"key":"/@maplibre/vt-pbf/-/@maplibre/vt-pbf-4.2.0.tgz"},"main":"dist/index.es.js","type":"module","types":"dist/index.d.ts","gitHead":"c2af3ea7a79e0c410b6944b6ebf8799b35a65881","scripts":{"lint":"eslint index.ts lib/*.ts","build":"rollup --config rollup.config.ts --configPlugin typescript && tsc","test-unit":"vitest run --config vitest.config.unit.ts","test-unit-ci":"vitest run --config vitest.config.unit.ts --coverage"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44edb4e4-8f74-4066-be34-2f0a2dfc7e53"}},"repository":{"url":"git+https://github.com/maplibre/vt-pbf.git","type":"git"},"_npmVersion":"11.6.2","description":"Serialize mapbox vector tiles to binary protobufs in javascript.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"pbf":"^4.0.1","geojson-vt":"^4.0.2","supercluster":"^8.0.1","@types/geojson-vt":"3.2.5","@mapbox/vector-tile":"^2.0.4","@types/supercluster":"^7.1.3","@mapbox/point-geometry":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.8.1","eslint":"^8.57.1","rollup":"^4.44.1","vitest":"^3.2.4","standard":"^17.1.2","benchmark":"^2.1.4","@eslint/js":"^9.30.0","geojson-vt":"^4.0.2","typescript":"^5.8.3","@types/node":"^24.0.3","geojson-equality":"^0.2.1","typescript-eslint":"^8.35.1","eslint-plugin-node":"^11.1.0","@vitest/coverage-v8":"^3.2.4","vite-tsconfig-paths":"^5.1.4","@mapbox/mvt-fixtures":"^3.10.0","@maplibre/vtvalidate":"^0.3.2","@rollup/plugin-strip":"^3.0.4","eslint-plugin-import":"^2.32.0","@rollup/plugin-terser":"^0.4.4","eslint-plugin-promise":"^6.0.0","@rollup/plugin-replace":"^6.0.2","eslint-config-standard":"^17.1.0","@mapbox/geojson-fixtures":"^1.0.0","@rollup/plugin-typescript":"^12.1.4","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/vt-pbf_4.2.0_1765772457084_0.9195483170482157","host":"s3://npm-registry-packages-npm-production"},"readme":"[![MapLibre Logo](https://maplibre.org/img/maplibre-logo-big.svg)](https://maplibre.org/)\n\n# vt-pbf \n[![NPM Version](https://img.shields.io/npm/v/@maplibre/vt-pbf.svg)](https://www.npmjs.com/package/@maplibre/vt-pbf)\n\nSerialize [Mapbox vector tiles](https://github.com/mapbox/vector-tile-spec) to binary protobufs in javascript.\n\n## Installation\nUsing NPM: `npm install @maplibre/vt-pbf`\n\nOr `npm run build` and find build artifacts in `dist/`\n\n## Usage\n\nAs far as I know, the two places you might get a JS representation of a vector\ntile are [geojson-vt](https://github.com/mapbox/geojson-vt) and\n[vector-tile-js](https://github.com/mapbox/vector-tile-js).  These both use\nslightly different internal representations, so serializing each looks slightly\ndifferent:\n\n## From vector-tile-js\n\n```javascript\nimport {fromVectorTileJs} from 'vt-pbf'\nimport {VectorTile} = from '@mapbox/vector-tile'\nimport Protobuf from 'pbf'\n\nvar data = fs.readFileSync(__dirname + '/fixtures/rectangle-1.0.0.pbf')\nvar tile = new VectorTile(new Protobuf(data))\nvar orig = tile.layers['geojsonLayer'].feature(0).toGeoJSON(0, 0, 1)\n\nvar buff = fromVectorTileJs(tile)\nfs.writeFileSync('my-tile.pbf', buff)\n```\n\n## From geojson-vt\n\n```javascript\nimport {fromGeojsonVt} from 'vt-pbf'\nimport geojsonVt from '@maplibre/geojson-vt'\n\nvar orig = JSON.parse(fs.readFileSync(__dirname + '/fixtures/rectangle.geojson'))\nvar tileindex = geojsonVt(orig)\nvar tile = tileindex.getTile(1, 0, 0)\n\n// pass in an object mapping layername -> tile object\nvar buff = fromGeojsonVt({ 'geojsonLayer': tile })\nfs.writeFileSync('my-tile.pbf', buff)\n```\n\n`fromGeojsonVt` takes two arguments:\n- `layerMap` is an object where keys are layer names and values are a geojson-vt tile,\n- `options` is an object (optional argument). There are 2 supported keys: `version` to define the version of the mvt spec used and `extent` to define the extent of the tile. `version` defaults to 1 and `extent` to 4096.\n\n","publish_time":1765772457216,"_cnpm_publish_time":1765772457216,"dist-tags":{"latest":"4.3.3"}}