mapbox-gl-function 0,0 travis-ci npm

Evaluate a Mapbox GL style function

2 years after

Mapbox GL style functions are used to specify a property value that varies according to zoom level. This library implements the semantics of interpolated and piecewise-constant functions as specified by the Mapbox GL Style Specification.

Usage

var glfun = require('mapbox-gl-function');

var identity = glfun.interpolated({type: 'identity'});
identity(0); // => '0'
identity('A'); // => 'A'
identity(['A']); // => ['A']

var exponential = glfun.interpolated({type: 'exponential', stops: [[1, 1], [5, 10]]});
exponential(0);  // => 1
exponential(1);  // => 1
exponential(3);  // => 5.5
exponential(5);  // => 10
exponential(11); // => 10

var interval = glfun.interpolated({type: 'interval', stops: [[1, 'a'], [3, 'b'], [4, 'c']]});
interval(0); // => 'a'
interval(1); // => 'a'
interval(2); // => 'a'
interval(3); // => 'b'
interval(4); // => 'c'

var categorical = glfun.interpolated({type: 'categorical', stops: [['A', 'a'], ['B', 'b'], ['C', 'c']]});
categorical('A'); // => 'a'
categorical('B'); // => 'b'
categorical('C'); // => 'c'

Related Repositories

awesome-react

awesome-react

A collection of awesome things regarding React ecosystem. ...

awesome-react-components

awesome-react-components

Catalog of React Components & Libraries ...

react-map-gl

react-map-gl

React friendly API wrapper around MapboxGL JS ...

ArticleTranslateProject

ArticleTranslateProject

AndroidWeekly中国文章翻译项目 ...

earcut

earcut

The fastest and smallest JavaScript polygon triangulation library for your WebGL ...


Top Contributors

lucaswoj ansis jfirebaugh yeldarby tmcw

Releases

-   v2.1.0 zip tar
-   v2.0.2 zip tar
-   v2.0.1 zip tar
-   v2.0.0 zip tar
-   v1.3.0 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar