# tile-cover

> generate the minimum number of tiles to cover a geojson geometry

Latest version **3.0.1** (published 2015-09-09) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install tile-cover
pnpm add tile-cover
yarn add tile-cover
bun add tile-cover
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2015-09-09 |
| First published | 2014-08-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 196 |
| Author | morganherlocker |
| Maintainers | morganherlocker, ajashton, lxbarth, mikemorris, ianshward, mourner, tristen, ingalls, ansis, jfirebaugh, miccolis, gretacb, aaronlidman, camilleanne, rclark, mapbox, willwhite, springmeyer, kkaefer, dthompson, yhahn, tmcw |
| Keywords | tile, cover, geojson, index |

## Links

- npm: https://www.npmjs.com/package/tile-cover
- Repository: https://github.com/mapbox/tile-cover
- Issues: https://github.com/mapbox/tile-cover/issues
- npm.io page: https://npm.io/package/tile-cover

## Dependencies (1)

- [tilebelt](https://npm.io/package/tilebelt.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.0.1 (latest) — 2015-09-09
- 3.0.0 — 2015-09-03
- 2.4.1 — 2015-03-26
- 2.4.0 — 2014-12-06
- 2.3.1 — 2014-11-26
- 2.3.0 — 2014-11-19
- 2.2.0 — 2014-11-19
- 2.1.2 — 2014-11-14
- 2.1.1 — 2014-11-13
- 2.1.0 — 2014-11-05
- 2.0.0 — 2014-11-04
- 1.0.0 — 2014-10-01
- 0.6.4 — 2014-09-26
- 0.6.3 — 2014-09-26
- 0.6.2 — 2014-09-26
- … 14 more at https://npm.io/package/tile-cover/versions

## README

tile-cover
==========

[![Build Status](https://travis-ci.org/mapbox/tile-cover.svg)](https://travis-ci.org/mapbox/tile-cover)

generate the minimum number of tiles to cover a geojson geometry

### Install

```bash
npm install tile-cover
```

### Usage

```js
var poly = JSON.parse(fs.readFileSync('./poly.geojson'));
var limits = {
  	min_zoom: 4,
  	max_zoom: 9
  }

cover.geojson(poly.geom, limits);
cover.tiles(poly.geom, limits);
cover.indexes(poly.geom, limits);
```

# API

## geojson(geom, limits)

Given a geometry, create cells and return them in a format easily readable by any software that reads GeoJSON.

* `geom` (`Object`): GeoJSON geometry
* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.

**Returns** `Object`, FeatureCollection of cells formatted as GeoJSON Features
## tiles(geom, limits)

Given a geometry, create cells and return them in their raw form, as an array of cell identifiers.

* `geom` (`Object`): GeoJSON geometry
* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.

**Returns** `Array.<Array.<number>>`, An array of tiles given as [x, y, z] arrays
## indexes(geom, limits)

Given a geometry, create cells and return them as quadkey indexes.

* `geom` (`Object`): GeoJSON geometry
* `limits` (`Object`): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.

**Returns** `Array.<String>`, An array of tiles given as quadkeys.

### Tests

```bash
npm test
```

### Benchmarks

```bash
node bench.js
```

### Examples

##### Polygons:

![img](https://dl.dropbox.com/s/48cj16fvt8nyh3o/Screenshot%202014-08-06%2013.34.12.png)

##### Lines:

![img](https://dl.dropbox.com/s/u32bq56adqwhpyy/Screenshot%202014-08-06%2013.30.31.png)

##### Points:

![img](https://dl.dropbox.com/s/7kkmmm8owg1ezb0/Screenshot%202014-08-06%2014.02.01.png)

---
_Source: https://npm.io/package/tile-cover · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
