{"_id":"@maplibre/vt-pbf@4.3.3","bugs":{"url":"https://github.com/maplibre/vt-pbf/issues"},"dist":{"shasum":"141f7cef627284eb1c953d872dfeac7a27f3484e","tarball":"http://registry-npm.ywwl.com/@maplibre/vt-pbf/download/@maplibre/vt-pbf-4.3.3.tgz","fileCount":13,"integrity":"sha512-dEe5XUd64RQbxNxy2OzIkJnwNDWjVmSXjCd0A7zLirm7QJ/WWbmtDFIkfsiM4yt1cplqzG6oSivRYeWx1SM1yg==","signatures":[{"sig":"MEUCIQCKWDZVQangJPeQE9sv/bEDgKjjyzL0BguDC4bBaOsowAIgRdgAmeerX9HYOZTAI+gc9wXlajtotCZX7fEIArC0i34=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF7TE9W2YcHk81VNycBYSrjr5fejJ9G1qsaUqsO3vo1/AiB+agUfLmK6uuMIQlfT7TqIG0U7dt/B91OK1r7TPfWveg=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@maplibre%2fvt-pbf@4.3.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":28105,"size":8194,"noattachment":false,"key":"/@maplibre/vt-pbf/-/@maplibre/vt-pbf-4.3.3.tgz"},"main":"dist/index.es.js","name":"@maplibre/vt-pbf","type":"module","types":"dist/index.d.ts","author":{"url":"http://anandthakker.net/","name":"Anand Thakker","email":"vestibule@anandthakker.net"},"gitHead":"a44e3d37f49286f6b23e939a20345596390780f0","license":"MIT","scripts":{"docs":"typedoc --entryPoints index.ts --out docs/API","lint":"eslint index.ts lib/**/*.ts test/**/*.ts","build":"rolldown -c rolldown.config.ts && tsc","test-unit":"vitest run --config vitest.config.unit.ts","test-unit-ci":"vitest run --config vitest.config.unit.ts --coverage"},"version":"4.3.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"44edb4e4-8f74-4066-be34-2f0a2dfc7e53"}},"homepage":"https://github.com/maplibre/vt-pbf#readme","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":{},"maintainers":[{"name":"maplibreorg","email":"board@maplibre.org"},{"name":"wayofthefuture","email":"ryan@scully.biz"},{"name":"harelmazor","email":"harel.mazor@gmail.com"},{"name":"birkskyum","email":"birk.skyum@pm.me"}],"_nodeVersion":"24.12.0","dependencies":{"pbf":"^5.1.2","@types/geojson":"^7946.0.16","@mapbox/point-geometry":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.8.1","eslint":"^10.13.0","vitest":"^5.0.5","typedoc":"^0.28.20","rolldown":"^1.2.15","benchmark":"^2.1.4","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/node":"^26.6.5","geojson-equality":"^0.2.1","typescript-eslint":"^8.72.0","@mapbox/vector-tile":"^3.0.0","@vitest/coverage-v8":"^5.0.5","@mapbox/mvt-fixtures":"^4.0.0","@maplibre/geojson-vt":"^6.3.0","@maplibre/vtvalidate":"^0.4.2","@types/geojson-equality":"^0.2.2","@mapbox/geojson-fixtures":"^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vt-pbf_4.3.3_1792922591131_0.9304152674914303"},"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":1792922591268,"_cnpm_publish_time":1792922591268,"dist-tags":{"latest":"4.3.3"}}