npm.io
1.3.0 • Published 1 week ago

@maplibre/mlt

Licence
(MIT OR Apache-2.0)
Version
1.3.0
Deps
1
Size
1.2 MB
Vulns
0
Weekly
0
Stars
556

maplibre-tile-spec

This package contains a JavaScript encoder and decoder for the experimental MapLibre Tile (MLT) vector tile format.

Install

npm install @maplibre/mlt

Quickstart

Decode a tile
import { decodeTile } from '@maplibre/mlt';

const data = fs.readFileSync(tilePath);
const tile = decodeTile(data);
Encode a tile
import { encodeTile, type Layer } from '@maplibre/mlt';

const layers: Layer[] = [
    {
        name: 'places',
        features: [
            {
                id: 1,
                geometry: { type: 'Point', coordinates: [10, 20] },
                properties: { name: 'Example' },
            },
        ],
    },
];

const data = encodeTile(layers);

Contents

Code

Code is in src/.

Tests

Tests are in test/unit/. Run tests by running npm run test. currently not integrated

Keywords