{"id":21558106,"url":"https://github.com/koopjs/koop-output-vector-tiles","last_synced_at":"2025-04-10T10:41:36.486Z","repository":{"id":24064288,"uuid":"100501239","full_name":"koopjs/koop-output-vector-tiles","owner":"koopjs","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-17T16:46:21.000Z","size":5570,"stargazers_count":17,"open_issues_count":19,"forks_count":10,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-24T09:38:14.705Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koopjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-16T14:57:47.000Z","updated_at":"2024-09-04T02:26:57.000Z","dependencies_parsed_at":"2023-01-14T00:20:50.456Z","dependency_job_id":null,"html_url":"https://github.com/koopjs/koop-output-vector-tiles","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-output-vector-tiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-output-vector-tiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-output-vector-tiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-output-vector-tiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koopjs","download_url":"https://codeload.github.com/koopjs/koop-output-vector-tiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199340,"owners_count":21063656,"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-11-24T08:13:59.205Z","updated_at":"2025-04-10T10:41:36.467Z","avatar_url":"https://github.com/koopjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @koopjs/output-vector-tiles\n\nThis output-services plugin converts GeoJSON to `pbf` vector tiles.\n\n## Install\n\n```bash\nnpm install --save @koopjs/output-vector-tiles\n```\n\n## Usage\n\nRegister this plugin with koop before your plugins to ensure that the `VectorTiles` routes are bound to the providers.\n\n```\nconst tile = require('@koopjs/output-vector-tiles')\nkoop.register(tiles)\n\n// Register providers\n```\n\nAfter startup, Koop will include `VectorTileServer` routes for each registered provider.  For example, if you had registered the Github provider, the following routes would be available:\n\n```bash\n/github/:id/VectorTileServer/:z([0-9]+)/:x([0-9]+)/:y([0-9]+).pbf                GET, POST\n/github/rest/services/:id/VectorTileServer/tiles.json                            GET\n/github/rest/services/:id/VectorTileServer                                       GET, POST\n/github/rest/services/:id/VectorTileServer/                                      GET, POST\n/github/rest/services/:id/VectorTileServer/resources/styles/root.json            GET\n```\n\n## Routes\n| Route | Method | Description |\n| --- | --- | --- |\n|`/VectorTileServer/:z([0-9]+)/:x([0-9]+)/:y([0-9]+).pbf`| GET, POST | Get a specific tile. |\n|`/VectorTileServer/tiles.json`| GET | Standard vector tile metadata. |\n|`/VectorTileServer`| GET, POST | ArcGIS vector tile metadata. |\n|`/VectorTileServer/`| GET, POST | ArcGIS vector tile metadata. |\n|`/VectorTileServer/resources/styles/root.json`| GET | ArcGIS vector tile styling info. |\n\n\n## Options and configuration\n\n### Using a tile set cache\nThis output plugin has a built-in in-memory cache for storing generated tile sets for a set period of time.  This may improve performance.  It is disabled by default. You can use it by setting your Koop config like:\n\n```javascript\n{\n  \"koopOutputVectorTiles\": {\n    \"cache\": true,\n    \"cacheExpiration\": 3600 // seconds to cache; defaults to 300\n  }\n}\n```\n\n### Tile generation settings\nThis plugin leverages [geojsonvt](https://github.com/mapbox/geojson-vt) to create tiles from GeoJSON.  If you want to adjust any of the geojsonvt settings, you can do so in the Config: \n\n```javascript\n{\n  \"koopOutputVectorTiles\": {\n    \"geojsonVT\":{\n      \"maxZoom\": , // max zoom to preserve detail on; can't be higher than 24\n      \"tolerance\": , // simplification tolerance (higher means simpler)\n      \"extent\": , // tile extent (both width and height)\n      \"buffer\": , // 64 is the original default, using a higher number like 512, 1024 or 2048 gets rid of some geojson artifacts but increases the tilesSetCache size // tile buffer on each side\n      \"debug\": , // logging level (0 to disable, 1 or 2)\n      \"lineMetrics\": , // whether to enable line metrics tracking for LineString/MultiLineString features\n      \"promoteId\": , // name of a feature property to promote to feature.id. Cannot be used with `generateId`\n      \"generateId\": , // whether to generate feature ids. Cannot be used with `promoteId`\n      \"indexMaxZoom\": , // max zoom in the initial tile index\n      \"indexMaxPoints\":  // max number of points per tile in the index\n      }\n  }\n}\n```\n\n### ArcGIS tile styling\nArcGIS applications make style requests to the vector tile server at `/VectorTileServer/resources/styles/root.json`. You can control the style served by this endpoint by either (1) setting default values in your config file, or (2) adding styling info to the GeoJSON metadata in your provider.\n\n#### ArcGIS style via config\n\nAdd `paint` configuration for each `circle`, `line`,and `fill` types:\n\n```javascript\n{\n  \"koopOutputVectorTiles\": {\n    \"circle\": {\n      \"paint\": {\n        \"circle-radius\": 3\n      }\n    },\n    \"line\": {\n      \"paint\": {\n        \"line-width\": 7\n      }\n    },\n    \"fill\": {\n      \"paint\": {\n        \"fill-opacity\": 0.25\n      }\n    }\n  }\n}\n```\n\nSee the [Mapbox style specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/) for additional properties that can be set in `paint`.\n\n#### ArcGIS style via your provider:\nYou can modify the GeoJSON metadata of your provider to handle styling:\n\n```javascript\n// inside your getData function\n\ngeojson.metadata = {}\ngeojson.metadata.vt = {}\ngeojson.metadata.vt = {\n  type: 'circle',\n  paint: {\n    'circle-radius': 4\n  }\n}\n\n```\n\n## Demos\nThis repo ships with both MapBoxGL and ArcGIS demo applications that consume Koop vector tiles.  To try it out:\n\n```bash\n# Install plugin dependencies\nnpm install\n\n# Move to demo directory\ncd demo\n\n# Install demo dependencies and start Express Koop server\nnpm install\nnpm start\n```\n\nThen open `mapbox-demo/index.html` or  `arcgis-js-api-demo.html` in the browser of your choice.  You should see vector tile rendered data around the city of Pasadena, CA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoopjs%2Fkoop-output-vector-tiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoopjs%2Fkoop-output-vector-tiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoopjs%2Fkoop-output-vector-tiles/lists"}