tilelive-gl

0.0.3 • Public • Published

tilelive-gl

Renderer backend for tilelive.js that uses node-mapbox-gl-native to render tiles from a Mapbox GL style.

Build Status

new GL(options, callback)

  • style: a Mapbox GL style string or object that will be used to render vector tiles.
  • scale: Optional, scale factor. Defaults to 1.

Usage

var GL = require('tilelive-gl');
 
new GL({ style: require('/path/to/file.json') }, function(err, map) {
    if (err) throw err;
 
    // Interface is in XYZ/Google coordinates.
    // Use `y = (1 << z) - 1 - y` to flip TMS coordinates.
    map.getTile(0, 0, 0, function(err, image) {
        // `err` is an error object when generation failed, otherwise null.
        // `image` contains the compressed image file as a Buffer
    });
});

Tilelive API

Though tilelive is not a dependency of tilelive-gl you will want to install it to make use of tilelive-gl through the tilelive API.

var tilelive = require('tilelive');
require('tilelive-gl').registerProtocols(tilelive);
 
tilelive.load('gl:///path/to/file.json', function(err, map) {
    map.getTile(0, 0, 0, function(err, image) {});
});

Readme

Keywords

Package Sidebar

Install

npm i tilelive-gl

Weekly Downloads

1

Version

0.0.3

License

none

Last publish

Collaborators

  • mikemorris