# tilelive-mapnik

> Mapnik backend for tilelive

Latest version **0.6.18** (published 2016-03-05) · 0 weekly downloads

## Install

```sh
npm install tilelive-mapnik
pnpm add tilelive-mapnik
yarn add tilelive-mapnik
bun add tilelive-mapnik
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.6.18 |
| Published | 2016-03-05 |
| First published | 2011-05-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 82 |
| Maintainers | aaronlidman, ajashton, ansis, bergwerkgis, bsudekum, camilleanne, dnomadb, dthompson, emilymcafee, flippmoke, freenerd, gretacb, ian29, ianshward, ingalls, jfirebaugh, karenzshea, kkaefer, lbud, lxbarth, mapbox-admin, mateov, miccolis, mikemorris, morganherlocker, mourner, nickidlugash, rclark, samanbb, sgillies, springmeyer, themarex, tmcw, tristen, willwhite, yhahn |
| Keywords | map, server, mapnik, tms |

## Links

- npm: https://www.npmjs.com/package/tilelive-mapnik
- Repository: http://github.com/mapbox/tilelive-mapnik
- Homepage: https://github.com/mapbox/tilelive-mapnik
- Issues: https://github.com/mapbox/tilelive-mapnik/issues
- npm.io page: https://npm.io/package/tilelive-mapnik

## Dependencies (5)

- [mime](https://npm.io/package/mime.md) ~1.3.4
- [step](https://npm.io/package/step.md) ~0.0.5
- [mapnik](https://npm.io/package/mapnik.md) >=3.2.0 && <4.0.0
- [generic-pool](https://npm.io/package/generic-pool.md) ~2.4.0
- [sphericalmercator](https://npm.io/package/sphericalmercator.md) ~1.0.4

## Recent versions

- 0.6.18 (latest) — 2016-03-05
- 0.6.17 — 2015-08-17
- 0.6.16 — 2015-03-25
- 0.6.15 — 2015-03-02
- 0.6.14 — 2014-11-22
- 0.6.13 — 2014-10-23
- 0.6.12 — 2014-09-29
- 0.6.11 — 2014-09-05
- 0.6.10 — 2014-07-25
- 0.6.9 — 2014-04-02
- 0.6.8 — 2014-03-13
- 0.6.7 — 2014-02-26
- 0.6.6 — 2014-02-26
- 0.6.5 — 2014-01-09
- 0.6.4 — 2013-11-18
- … 24 more at https://npm.io/package/tilelive-mapnik/versions

## README

# tilelive-mapnik

Renderer backend for [tilelive.js](http://github.com/mapbox/tilelive.js) that
uses [node-mapnik](http://github.com/mapnik/node-mapnik) to render tiles and
grids from a Mapnik XML file. `tilelive-mapnik` implements the
[Tilesource API](https://github.com/mapbox/tilelive.js/blob/master/API.md).

[![Build Status](https://secure.travis-ci.org/mapbox/tilelive-mapnik.png)](http://travis-ci.org/mapbox/tilelive-mapnik)
[![Build status](https://ci.appveyor.com/api/projects/status/6am7la0hiaei8qop)](https://ci.appveyor.com/project/Mapbox/tilelive-mapnik)

## Installation

    npm install tilelive-mapnik

Though `tilelive` is not a dependency of `tilelive-mapnik` you will want to
install it to actually make use of `tilelive-mapnik` through a reasonable
API.


## Usage

```javascript
var tilelive = require('tilelive');
require('tilelive-mapnik').registerProtocols(tilelive);

tilelive.load('mapnik:///path/to/file.xml', function(err, source) {
    if (err) throw err;

    // Interface is in XYZ/Google coordinates.
    // Use `y = (1 << z) - 1 - y` to flip TMS coordinates.
    source.getTile(0, 0, 0, function(err, tile, headers) {
        // `err` is an error object when generation failed, otherwise null.
        // `tile` contains the compressed image file as a Buffer
        // `headers` is a hash with HTTP headers for the image.
    });

    // The `.getGrid` is implemented accordingly.
});
```

Note that grid generation will only work when there's metadata inside a
`<Parameters>` object in the Mapnik XML.

The key fields are `interactivity_layer` and `interactivity_fields`. See an
[example in the tests](https://github.com/mapbox/tilelive-mapnik/blob/4e9cbf8347eba7c3c2b7e8fd4270ea39f9cc7af5/test/data/test.xml#L6-L7). These `Parameters` are normally added by the application that creates the XML,
in this case [CartoCSS](https://github.com/mapbox/carto/blob/55fbafe0d0e8ec00515c5782a3664c15502f0437/lib/carto/renderer.js#L152-L189)

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