tile-mixer

0.3.3 • Public • Published

tile-mixer

tests

Re-mix vector tile layers based on a MapLibre style document

Raw vector tile data is organized into a set of layers determined by the tile provider. But for rendering in maps, a new layer definition is specified by the map designer in the MapLibre style document. tile-mixer filters and re-orders the tile data into a new layers object, where the keys are the names of the style layers, and the values are GeoJSON FeatureCollections.

Initialization

A tile-mixer function can be initialized as follows:

import * as tileMixer from 'tile-mixer';

const mixer = tileMixer.init(parameters);

The supplied parameters object has the following properties:

  • layers (REQUIRED): An array containing the layers from the style document that use data from a given source

API

Initialization returns a function with the following signature:

const remixedLayers = mixer(source, zoom);

The arguments are:

  • source: A dictionary of GeoJSON FeatureCollections, with each collection containing the features for each layer of the tile, as returned by tile-retriever
  • zoom: The native zoom level of the tile (usually its z-index)

The return value is a dictionary of FeatureCollections of the remixed tile data. The data structure is comparable to the input source, with the keys of the dictionary replaced by the names of the layers from the style document

Package Sidebar

Install

npm i tile-mixer

Weekly Downloads

7

Version

0.3.3

License

MIT

Unpacked Size

8.39 kB

Total Files

4

Last publish

Collaborators

  • jjhembd