{"name":"geojson-vt","version":"5.0.0","keywords":["spatial","geojson","tiles","geometry"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","_id":"geojson-vt@5.0.0","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"},{"name":"mourner","email":"agafonkin@gmail.com"}],"homepage":"https://github.com/mapbox/geojson-vt","bugs":{"url":"https://github.com/mapbox/geojson-vt/issues"},"dist":{"shasum":"9116e4bcbe529e829f6d6dc08b81c672954cc8c4","tarball":"http://registry-npm.ywwl.com/geojson-vt/download/geojson-vt-5.0.0.tgz","fileCount":14,"integrity":"sha512-h7rXWCEak5seVDeZR0JBByNy8qX7CQxYWXwkSsV+phYxmnYmacbMQCRAJ/zI6nK/1IO9uvhwtP5HArngXoVvqw==","signatures":[{"sig":"MEYCIQDkTyHIT5dbR2nGzt8nqd3TQ3uBa+Iwuc6VOUscfSyaOAIhAMeFHhKlS8VhgsgD8j1NZS50rmv/9zwQB6qUAbhV6cEV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDVBFCr2cIVCeSKyZEUyXWgqpI8rGTbaMjYTVdadRbUvwIgBkM1YsfMMmLC2Tels0NdV3jqwwvOO47zmr++oYl5804=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":125580,"size":30028,"noattachment":false,"key":"/geojson-vt/-/geojson-vt-5.0.0.tgz"},"main":"geojson-vt-dev.js","type":"module","types":"./src/index.d.ts","unpkg":"geojson-vt.js","module":"src/index.js","exports":"./src/index.js","gitHead":"8e4c39868280660c0b24c3d8cdce3699478de7ff","scripts":{"cov":"node --experimental-test-coverage --test","test":"node --test","bench":"node --expose-gc bench/bench.js","build":"rollup -c","watch":"rollup -cw","pretest":"eslint src/*.js test/*.js debug/*.js bench/bench.js eslint.config.js && tsc --noEmit","prepublishOnly":"npm run test && npm run build"},"_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"jsdelivr":"geojson-vt.js","repository":{"url":"git://github.com/mapbox/geojson-vt.git","type":"git"},"_npmVersion":"12.0.2","description":"Slice GeoJSON data into vector tiles efficiently","directories":{},"sideEffects":false,"_nodeVersion":"24.18.1","dependencies":{"@types/geojson":"^7946.0.16"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.9.1","rollup":"^4.63.1","benchmark":"^2.1.4","typescript":"^7.0.2","@rollup/plugin-terser":"^1.0.0","eslint-config-mourner":"^5.0.1"},"_npmOperationalInternal":{"tmp":"tmp/geojson-vt_5.0.0_1788421315632_0.7163988152933722","host":"s3://npm-registry-packages-npm-production"},"readme":"## geojson-vt &mdash; GeoJSON Vector Tiles [![Node](https://github.com/mapbox/geojson-vt/actions/workflows/node.yml/badge.svg)](https://github.com/mapbox/geojson-vt/actions/workflows/node.yml) [![](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)\n\nA highly efficient JavaScript library for **slicing GeoJSON data into vector tiles on the fly**,\nprimarily designed to enable rendering and interacting with large geospatial datasets\non the browser side (without a server).\n\nCreated to power GeoJSON in [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js),\nbut can be useful in other visualization platforms\nlike [Leaflet](https://github.com/Leaflet/Leaflet), [OpenLayers](https://openlayers.org/) and [d3](https://github.com/mbostock/d3),\nas well as Node.js server applications.\n\nResulting tiles conform to the JSON equivalent\nof the [vector tile specification](https://github.com/mapbox/vector-tile-spec/).\nTo make data rendering and interaction fast, the tiles are simplified,\nretaining the minimum level of detail appropriate for each zoom level\n(simplifying shapes, filtering out tiny polygons and polylines).\n\nRead more on how the library works [on the Mapbox blog](https://blog.mapbox.com/rendering-big-geodata-on-the-fly-with-geojson-vt-4e4d2a5dd1f2).\n\nThere's a C++11 port: [geojson-vt-cpp](https://github.com/mapbox/geojson-vt-cpp)\n\n### Demo\n\nHere's **geojson-vt** action in [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js),\ndynamically loading a 100Mb US zip codes GeoJSON with 5.4 million points:\n\n![](https://cloud.githubusercontent.com/assets/25395/5360312/86028d8e-7f91-11e4-811f-87f24acb09ca.gif)\n\nThere's a convenient [debug page](http://mapbox.github.io/geojson-vt/debug/) to test out **geojson-vt** on different data.\nJust drag any GeoJSON on the page, watching the console.\n\n![](https://cloud.githubusercontent.com/assets/25395/5363235/41955c6e-7fa8-11e4-9575-a66ef54cb6d9.gif)\n\n### Usage\n\n```js\n// build an initial index of tiles\nconst tileIndex = new GeoJSONVT(geoJSON);\n\n// request a particular tile\nconst features = tileIndex.getTile(z, x, y).features;\n\n// show an array of tile coordinates created so far\nconsole.log(tileIndex.tileCoords); // [{z: 0, x: 0, y: 0}, ...]\n```\n\n`getTile` returns `null` outside the data, and builds a fresh `[x, y]`-pair structure on every call.\nFor a zero-copy alternative, `getTileRaw` hands back the tile as stored &mdash; flat\n`[x, y, x, y, ...]` typed arrays, one per ring, with no per-coordinate objects:\n\n```js\nconst {features} = tileIndex.getTileRaw(z, x, y);\n\nfor (const {type, geometry} of features) {\n\t// type 4 is a lone point, with `x`/`y` inline instead of a `geometry`;\n\t// 1 is a multi-point (one flat array), 2 and 3 are lines and polygons (an array of rings)\n}\n```\n\nThe arrays belong to the index, so treat them as read-only and don't hold them past its lifetime.\n\n### Options\n\nYou can fine-tune the results with an options object,\nalthough the defaults are sensible and work well for most use cases.\n\n```js\nconst tileIndex = new GeoJSONVT(data, {\n\tmaxZoom: 14,  // max zoom to preserve detail on; can't be higher than 24\n\ttolerance: 3, // simplification tolerance (higher means simpler)\n\textent: 4096, // tile extent (both width and height)\n\tbuffer: 64,   // tile buffer on each side\n\tdebug: 0,     // logging level (0 to disable, 1 or 2)\n\tlineMetrics: false, // whether to enable line metrics tracking for LineString/MultiLineString features\n\tpromoteId: null,    // name of a feature property to promote to feature.id. Cannot be used with `generateId`\n\tgenerateId: false,  // whether to generate feature ids. Cannot be used with `promoteId`\n\tindexMaxZoom: 5,       // max zoom in the initial tile index\n\tindexMaxPoints: 100000 // max number of points per tile in the index\n});\n```\n\nBy default, tiles at zoom levels above `indexMaxZoom` are generated on the fly, but you can pre-generate all possible tiles for `data` by setting `indexMaxZoom` and `maxZoom` to the same value, setting `indexMaxPoints` to `0`, and then accessing the resulting tile coordinates from the `tileCoords` property of `tileIndex`.\n\nThe `promoteId` and `generateId` options ignore existing `id` values on the feature objects.\n\nGeoJSON-VT only operates on zoom levels up to 24.\n\n### Install\n\nInstall using NPM (`npm install geojson-vt`), then:\n\n```js\n// import as a ES module\nimport GeoJSONVT from 'geojson-vt';\n\n// import from a CDN in the browser:\nimport GeoJSONVT from 'https://esm.run/geojson-vt';\n```\n\nOr use a browser build directly:\n\n```html\n<script src=\"https://unpkg.com/geojson-vt/geojson-vt.js\"></script>\n<script>\n    const tileIndex = new GeoJSONVT(geoJSON); // exposed as a `GeoJSONVT` global\n</script>\n```\n\n### TypeScript\n\nType declarations ship with the library; remove `@types/geojson-vt` if you have it.\n\n```ts\nimport GeoJSONVT, {type Options, type LegacyFeature} from 'geojson-vt';\n\nconst options: Options = {maxZoom: 12};\nconst tile = new GeoJSONVT(geoJSON, options).getTile(0, 0, 0); // null outside the data\nconst features: LegacyFeature[] = tile ? tile.features : [];\n```\n","publish_time":1788421315721,"_cnpm_publish_time":1788421315721,"dist-tags":{"latest":"5.0.4"}}