mlt_py
Python bindings for the MapLibre Tile (MLT) format via PyO3.
=
# Structured decode with geo-referencing
=
# Raw tile-local coordinates (no z/x/y needed)
=
# GeoJSON string output (tile-local coords)
=
# Fast layer listing (no full decode)
=
Encoding
encode_geojson(geojson, name, extent=4096) -> bytes encodes a single layer to an MLT blob:
geojsonis a GeoJSONFeatureCollection. Geometry is in tile-local coordinate space (no projection), matchingtilezen/mapbox-vector-tile's default. Coordinates must be integers and 2D. They must be JSON integers (2048), not floats: a float-typed value such as2048.0raisesValueError.nameandextentset the MLT layer metadata, since aFeatureCollectionhas no slot for them. extentdefaults to4096`.
=
# Multi-layer tiles -> encode each layer and concatenate the bytes
= b
Input is validated strictly.
A non-FeatureCollection input, a non-Feature member, float-typed or 3D coordinates, null or empty geometry, nested or non-scalar property values, a non-u64 id, and an empty collection all raise ValueError.