@davvo/ak-draw-canvas
Draw map on canvas. Fetches vector tiles from specified url.
Last updated 4 years ago by davvo .
Original npm · Tarball · package.json
$ cnpm install @davvo/ak-draw-canvas 
SYNC missed versions from official npm registry.

ak-draw-canvas

Draw map on canvas. Fetches vector tiles from specified url.

To be used both in the browser and on the server (requires node-canvas).

Install

$ npm install @davvo/ak-draw-canvas

Usage

let Canvas = require('canvas'),
    styles = require('@davvo/ak-styles')

let drawCanvas = require('@davvo/ak-draw-canvas')({
  url: '<vtiles-url>',
  createCanvas: function (width, height) {
    return new Canvas(width, height)
  }
})

let params = {
  lat: 63.82621,
  lng: 20.261364,
  zoom: 19,
  width: 1000,
  height: 1400
}

let style = styles['pop-teal-marsala']

drawCanvas(params, style, function (err, canvas) {
  // use canvas
})
 

In the browser "new Canvas()" is not available:

let drawCanvas = require('@davvo/ak-draw-canvas')({
  url: '<vtiles-url>',
  createCanvas: function (width, height) {
    let canvas = document.createElement('canvas')
    canvas.width = width
    canvas.height = height
    return canvas
  }
})

Current Tags

  • 1.1.0                                ...           latest (4 years ago)

2 Versions

  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |