# mapnik-pool

> manage a pool of mapnik instances

Latest version **0.1.3** (published 2016-01-27) · ISC license · 0 weekly downloads

## Install

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

## 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.1.3 |
| Published | 2016-01-27 |
| First published | 2014-04-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Tom MacWright |
| Maintainers | aaronlidman, ajashton, ansis, camilleanne, dthompson, gretacb, ianshward, ingalls, jfirebaugh, kkaefer, lxbarth, mapbox-admin, miccolis, mikemorris, morganherlocker, mourner, rclark, springmeyer, tmcw, tristen, willwhite, yhahn |
| Keywords | mapnik, pool, maps |

## Links

- npm: https://www.npmjs.com/package/mapnik-pool
- Repository: git@github.com:mapbox/mapnik-pool
- Homepage: https://github.com/mapbox/mapnik-pool
- Issues: https://github.com/mapbox/mapnik-pool/issues
- npm.io page: https://npm.io/package/mapnik-pool

## Dependencies (2)

- [xtend](https://npm.io/package/xtend.md) ~4.0.0
- [generic-pool](https://npm.io/package/generic-pool.md) ~2.2.1

## Recent versions

- 0.1.3 (latest) — 2016-01-27
- 0.1.2 — 2015-11-05
- 0.1.1 — 2014-12-20
- 0.1.0 — 2014-10-02
- 0.0.0 — 2014-04-27

## README

![mapnik-pool](https://cloud.githubusercontent.com/assets/83384/4493143/fe155e76-4a46-11e4-81db-61f319910acb.png)

[![Build Status](https://travis-ci.org/mapbox/mapnik-pool.svg?branch=master)](https://travis-ci.org/mapbox/mapnik-pool)
[![Coverage Status](https://coveralls.io/repos/mapbox/mapnik-pool/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapbox/mapnik-pool?branch=master)

# mapnik-pool

If you want to use `node-mapnik` in an app with concurrency, you'll want to use
a map pool. By design Mapnik Maps are not meant to be shared between threads because datasources hold state. This [may change in the future](https://github.com/mapnik/mapnik/issues/2521) but for now using a single map instance with async node-mapnik rendering functions may your app. Also using several map instances will give you a significant speedup. `mapnik-pool` manages a `generic-pool` of `mapnik.Map` instances so you don't have to.

## install

    npm install --save mapnik-pool

## dependency structure

`mapnik-pool` is a [peerDependency](http://domenic.me/2013/02/08/peer-dependencies/)
of `node-mapnik`: you bring your own Mapnik version, as long as its `~1.0.0`.

## example

```js
var mapnik = require('mapnik'),
    mapnikPool = require('mapnik-pool')(mapnik),
    fs = require('fs');

var pool = mapnikPool.fromString(fs.readFileSync('mymap.xml', 'utf8'));

pool.acquire(function(err, map) {
    // pooled map
});
```

## api

### `fromString(str, initOptions, mapOptions)`

* `str`: a Mapnik XML string
* `initOptions`: options for initialization. Currently, `size` for map, `bufferSize`. Default `{ size: 256 }`
* `mapOptions`: options for the `fromString` method.

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