{"id":13784295,"url":"https://github.com/mapbox/vector-tile-js","last_synced_at":"2025-05-11T19:32:39.817Z","repository":{"id":15972522,"uuid":"18715334","full_name":"mapbox/vector-tile-js","owner":"mapbox","description":"Parses vector tiles with JavaScript","archived":false,"fork":false,"pushed_at":"2024-07-16T09:41:00.000Z","size":258,"stargazers_count":363,"open_issues_count":11,"forks_count":90,"subscribers_count":136,"default_branch":"main","last_synced_at":"2025-05-06T06:48:24.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-12T21:38:34.000Z","updated_at":"2025-04-30T17:04:55.000Z","dependencies_parsed_at":"2024-10-08T17:16:40.713Z","dependency_job_id":"d24b5ec9-389d-4b9a-a971-b912b508493c","html_url":"https://github.com/mapbox/vector-tile-js","commit_stats":{"total_commits":81,"total_committers":17,"mean_commits":4.764705882352941,"dds":0.7160493827160495,"last_synced_commit":"77851380b63b07fd0af3d5a3f144cc86fb39fdd1"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fvector-tile-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fvector-tile-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fvector-tile-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fvector-tile-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/vector-tile-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252869120,"owners_count":21816980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T19:00:39.413Z","updated_at":"2025-05-11T19:32:39.475Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","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])** \u0026mdash;\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) \u0026mdash; an object containing parsed layers in the form of `{\u003cname\u003e: \u003clayer\u003e, ...}`,\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`) \u0026mdash; layer name\n- **extent** (`Number`, default: `4096`) \u0026mdash; tile extent size\n- **length** (`Number`) \u0026mdash; number of features in the layer\n\n#### Methods\n\n- **feature(i)** \u0026mdash; 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`) \u0026mdash; type of the feature (also see `VectorTileFeature.types`)\n- **extent** (`Number`) \u0026mdash; feature extent size\n- **id** (`Number`) \u0026mdash; feature identifier, if present\n- **properties** (`Object`) \u0026mdash; object literal with feature properties\n\n#### Methods\n\n- **loadGeometry()** \u0026mdash; 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()** \u0026mdash; calculates and returns the bounding box of the feature in the form `[x1, y1, x2, y2]`\n- **toGeoJSON(x, y, z)** \u0026mdash; returns a GeoJSON representation of the feature. (`x`, `y`, and `z` refer to the containing tile's index.)\n","funding_links":[],"categories":["JavaScript","Uncategorized","Parsers \u0026 Generators"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fvector-tile-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fvector-tile-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fvector-tile-js/lists"}