Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@carto/cartonik

Package Overview
Dependencies
Maintainers
17
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@carto/cartonik

Render maps with @carto/mapnik

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
17
Created
Source

Cartonik

CircleCI

Render maps with @carto/mapnik

Features

  • Render tiles from a Mapnik XML
  • Support several formats: png, jpeg, grid.json, mvt, etc..
  • Support traditional mapnik datasources: shape, postgis, gdal, ogr, etc..
  • Optimized for high-performance services

Installation

Cartonik requires Node.js 10 or higher

npm install cartonik

Hello Cartonik

const cartonik = require('cartonik')

const renderer = cartonik({ xml: '<Map>...</Map>' })
const [ format, z, x, y ] = [ 'png', 0, 0, 0 ]

const tile = await renderer.getTile(format, z, x, y)

Usage: cartonik(options)

const options = { ... }
const renderer = cartonik(options)

Options

Generic options

  • type: string (either raster or vector, default raster). Whether the renderer aims to render Mapnik Vector Tiles or traditional raster formats (png, utf).
  • xml: string (required). The Mapnik XML configuration.
  • base: string. Path to the folder where the datasources files are (e.g. shapefiles).
  • strict: boolean (default false). Enables mapnik strict mode.
  • bufferSize: number (default 256). Extra space, in pixels, surrounding the map size being rendered. This allows you to have text and symbols rendered correctly when they overlap the image boundary.
  • poolSize: number (default os.cpus().length). Max number of preloaded maps available for rendering.
  • poolMaxWaitingClients: number (default 32). Max number of waiting clients to acquire one of the preloaded maps.
  • tileSize: number (default 256). Size of the tile in pixels.
  • limits: object.
    • render: number (default 0 = disabled). Time in milliseconds to wait for the renderer to return a tile.
  • metrics: boolean (default false). Configure @carto/mapnik to gather statistics about rendering performance.
  • variables: object. A key-value dictionary to customize map configuration at render-time. Placeholders defined in xml (e.g. <PolygonSymbolizer fill="@water"/>) will be replaced with the values defined here (e.g. { water: 'blue' }).

Raster options (type = raster)

  • metatile: number (default 2). The number of tiles included in a metatile. One metatile generates a group of images at once in batches before separating them into the final tiles - this improves efficiency in various ways.
  • metatileCache: object.
    • timeout: number (default 1 minute). When the timeout fires, it removes the cached tiles.
    • deleteOnHit: boolean (default false). Removes the cached tile after delivered.
  • scale: number (default 1). Multiplier to scale up size-related properties of symbolizers.
  • resolution: number (default 4). When format = utf, the factor to scale down the tile size.

Vector options (type = vector)

  • gzip: boolean (default true). Compression method used to encoding a vector tile.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the BSD 3-clause "New" or "Revised" License - see the LICENSE file for details.

FAQs

Package last updated on 29 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc