mapnik-pool

    0.1.3 • Public • Published

    mapnik-pool

    Build Status Coverage Status

    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 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 of node-mapnik: you bring your own Mapnik version, as long as its ~1.0.0.

    example

    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.

    Install

    npm i mapnik-pool

    DownloadsWeekly Downloads

    276

    Version

    0.1.3

    License

    ISC

    Last publish

    Collaborators

    • arunasank
    • mapsam
    • samanbb
    • nickidlugash
    • lbud
    • bsudekum
    • mapbox-admin
    • ajashton
    • lxbarth
    • ianshward
    • mourner
    • tristen
    • ingalls
    • morganherlocker
    • ansis
    • jfirebaugh
    • miccolis
    • gretacb
    • rclark
    • willwhite
    • springmeyer
    • kkaefer
    • yhahn