Skip to main content

MLTLoader

From-v4.4

Loader for the MapLibre Tile (MLT) geospatial tile format.

LoaderCharacteristic
File Extension.mlt
File TypeBinary
File FormatMapLibre Tile
MIME Typesapplication/vnd.maplibre-tile
Data FormatGeometry
Supported APIsload, parse, parseSync
Worker ThreadNot available for this loader

Installation​

npm install @loaders.gl/mlt
npm install @loaders.gl/core

Usage​

import {MLTLoader} from '@loaders.gl/mlt';
import {load} from '@loaders.gl/core';

const tileFeatures = await load(url, MLTLoader);

Geometry in local tile space​

By default, MLTLoader returns GeoJSON features using local tile coordinates in [0, 1] space:

import {MLTLoader} from '@loaders.gl/mlt';
import {load} from '@loaders.gl/core';

const geoJSONfeatures = await load(url, MLTLoader);

Geometry in WGS84​

Set coordinates: 'wgs84' and provide the tile index to get longitude / latitude coordinates:

import {MLTLoader} from '@loaders.gl/mlt';
import {load} from '@loaders.gl/core';

const geoJSONfeatures = await load(url, MLTLoader, {
mlt: {
coordinates: 'wgs84',
tileIndex: {
x: tileX,
y: tileY,
z: tileZ
}
}
});

Output shapes​

shape optionOutput
'geojson' (default)Feature[]
'geojson-table'GeoJSONTable
'binary'binary feature collection

Options​

OptionTypeDefaultDescription
mlt.shape'geojson-table' | 'geojson' | 'binary'geojsonOutput shape: GeoJSON array, GeoJSON table, or binary features
mlt.coordinates'local' | 'wgs84'localCoordinate system for returned geometries
mlt.tileIndex{x: number, y: number, z: number}N/ARequired when coordinates is wgs84
mlt.layerPropertystringlayerNameName of layer property added to feature properties
mlt.layersstring[]N/ARestrict parsing to specific tile layers

mlt.tileIndex is required for WGS84 output.

Additional examples​

Attribution​

MLTLoader implements loaders.gl integration, GeoJSON/binary shaping, and coordinate projection around the @maplibre/mlt decoder and the MapLibre Tile specification.