tile-mixer
v0.3.3
Published
Re-mix vector tile layers based on a MapLibre style document
Downloads
51
Readme
tile-mixer
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-retrieverzoom
: 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