{"id":13426165,"url":"https://github.com/mapbox/tile-cover","last_synced_at":"2025-03-15T21:30:43.983Z","repository":{"id":19419039,"uuid":"22661445","full_name":"mapbox/tile-cover","owner":"mapbox","description":"Generate the minimum number of tiles to cover a geojson geometry","archived":false,"fork":false,"pushed_at":"2020-09-11T01:18:38.000Z","size":2326,"stargazers_count":189,"open_issues_count":9,"forks_count":40,"subscribers_count":121,"default_branch":"master","last_synced_at":"2024-10-28T04:25:35.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-05T22:21:40.000Z","updated_at":"2024-07-18T00:30:17.000Z","dependencies_parsed_at":"2022-08-07T09:15:18.895Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/tile-cover","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Ftile-cover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Ftile-cover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Ftile-cover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Ftile-cover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/tile-cover/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243792285,"owners_count":20348607,"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-07-31T00:01:27.850Z","updated_at":"2025-03-15T21:30:43.572Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","readme":"tile-cover\n==========\n\n[![Build Status](https://travis-ci.org/mapbox/tile-cover.svg?branch=master)](https://travis-ci.org/mapbox/tile-cover)\n\nGenerate the minimum number of tiles to cover a [GeoJSON Geometry](http://geojson.org/geojson-spec.html#geometry-objects).\n\n### Install\n\n```bash\nnpm install @mapbox/tile-cover\n```\n\n### Usage\n\n```js\nvar cover = require('@mapbox/tile-cover');\nvar poly = JSON.parse(fs.readFileSync('./poly.geojson'));\nvar limits = {\n  \tmin_zoom: 4,\n  \tmax_zoom: 9\n};\n\ncover.geojson(poly.geom, limits);\ncover.tiles(poly.geom, limits);\ncover.indexes(poly.geom, limits);\n```\n\n# API\n\n## geojson(geom, limits)\n\nGiven a [geometry](http://geojson.org/geojson-spec.html#geometry-objects), create cells and return them in a format easily readable by any software that reads GeoJSON.\n\n* `geom` (`Object`): GeoJSON geometry\n* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.\n\n**Returns** `Object`, FeatureCollection of cells formatted as GeoJSON Features\n## tiles(geom, limits)\n\nGiven a [geometry](http://geojson.org/geojson-spec.html#geometry-objects), create cells and return them in their raw form, as an array of cell identifiers.\n\n* `geom` (`Object`): GeoJSON geometry\n* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.\n\n**Returns** `Array.\u003cArray.\u003cnumber\u003e\u003e`, An array of tiles given as [x, y, z] arrays\n## indexes(geom, limits)\n\nGiven a [geometry](http://geojson.org/geojson-spec.html#geometry-objects), create cells and return them as quadkey indexes.\n\n* `geom` (`Object`): GeoJSON geometry\n* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.\n\n**Returns** `Array.\u003cString\u003e`, An array of tiles given as quadkeys.\n\n### Tests\n\n```bash\nnpm test\n```\n\n### Benchmarks\n\n```bash\nnode bench.js\n```\n\n### Examples\n\n##### Polygons:\n\n![img](https://dl.dropbox.com/s/48cj16fvt8nyh3o/Screenshot%202014-08-06%2013.34.12.png)\n\n##### Lines:\n\n![img](https://dl.dropbox.com/s/u32bq56adqwhpyy/Screenshot%202014-08-06%2013.30.31.png)\n\n##### Points:\n\n![img](https://dl.dropbox.com/s/7kkmmm8owg1ezb0/Screenshot%202014-08-06%2014.02.01.png)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Ftile-cover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Ftile-cover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Ftile-cover/lists"}