mlt_py
Python bindings for the MapLibre Tile (MLT) format via PyO3.
Decoding
import maplibre_tiles
data = open("tile.mlt", "rb").read()
# Structured decode with geo-referencing
layers = maplibre_tiles.decode_mlt(data, z=14, x=8297, y=10749, tms=True)
for layer in layers:
print(f"Layer: {layer.name}, extent: {layer.extent}")
for feat in layer.features[:3]:
print(f" id={feat.id}, type={feat.geometry_type}")
print(f" wkb={len(feat.wkb)} bytes, props={dict(feat.properties)}")
# Raw tile-local coordinates (no z/x/y needed)
layers = maplibre_tiles.decode_mlt(data)
# GeoJSON string output (tile-local coords)
geojson_str = maplibre_tiles.decode_mlt_to_geojson(data)
# Fast layer listing (no full decode)
names = maplibre_tiles.list_layers(data)
Decoded objects
decode_mlt(...) returns a list of MltLayer objects.
Each MltLayer represents one decoded MLT layer and exposes:
name: str- the layer name.extent: int- the layer extent.features: list[MltFeature]- the decoded features in that layer.
Each MltFeature represents one decoded feature and exposes:
id: int | None- the feature id, if present.geometry_type: str- the decoded geometry type.wkb: bytes- the geometry as WKB.properties: dict- the feature properties.
import maplibre_tiles
layers = maplibre_tiles.decode_mlt(data)
for layer in layers:
print(layer.name, layer.extent)
for feature in layer.features[:2]:
print(feature.id, feature.geometry_type, dict(feature.properties))
Encoding
encode_geojson(geojson, name, extent=4096, *, tessellate=False, sort="auto", shared_dict=True, fsst=True, fastpfor=True) -> 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.tessellategenerates triangulation data for polygons and multi-polygons.sortcontrols which feature ordering(s) the encoder tries:all,auto,morton,hilbert,id, ornone.shared_dictenables grouping strings into shared dictionaries.fsstenables FSST string compression.fastpforenables FastPFOR integer compression.
encode_mvt(data, *, tessellate=False, sort="auto", shared_dict=True, fsst=True, fastpfor=True) -> bytes encodes an entire raw Mapbox Vector Tile (protobuf) to MLT using the same encoding options.
import maplibre_tiles
blob = maplibre_tiles.encode_geojson(
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 1,
"geometry": {"type": "Point", "coordinates": },
"properties": {"name": "main", "lanes": 3},
},
],
},
name="roads",
extent=4096,
)
# Multi-layer tiles -> encode each layer and concatenate the bytes
tile = b"".join([
maplibre_tiles.encode_geojson(roads, name="roads"),
maplibre_tiles.encode_geojson(water, name="water"),
])
import maplibre_tiles
mvt = open("tile.mvt", "rb").read()
blob = maplibre_tiles.encode_mvt(mvt)
# With explicit encoding options
blob = maplibre_tiles.encode_mvt(
mvt,
tessellate=False,
sort="auto",
shared_dict=True,
fsst=True,
fastpfor=True,
)
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.
Release files for maplibre-tiles 0.1.27
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| maplibre_tiles-0.1.27.tar.gz | 249.1 kB | Details |
Built distributions (wheels)
Total release size: 17.1 MB
Release files / maplibre_tiles-0.1.27.tar.gz
| Download URL | maplibre_tiles-0.1.27.tar.gz |
|---|---|
| Size | 249.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da3c06a2c5f1ed135190828a3e2ec0c5e954cae30ee7793745b84024ab0f1d7f
|
|
BLAKE2b-256 checksum How to use checksums |
212facca6d13def65b75ce9e18963504a6eb84179d402c13df95bcbcd24fb718
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp314-cp314-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp314-cp314-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 766.7 kB |
| Tags | CPython 3.14 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
7b8e63500daede30c3d5a71592c1db09213432884a3985bf912efbf182feab1e
|
|
BLAKE2b-256 checksum How to use checksums |
b54c98c8fb6c56c6b7d5c48d9c169c8d249baa749fa1b739d8d4919ec130dfe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.1.27-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9934e4cc6992d75cfcbcb02d6b446cbae32dce41b7fc55ac4e5a36fa5712a7a3
|
|
BLAKE2b-256 checksum How to use checksums |
031981ce4bc94f1d4da876c15be6b20c79f735f4dea7d104eaf34eb4289e7dfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c6efb4c9cee5eac20077b4a362e531e7fe7b6f5d28068143225d28318a886a9b
|
|
BLAKE2b-256 checksum How to use checksums |
33b66ca3fcf925e55fb7bf75dd646f29013523688347d59bfd4ed970a074c738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.1.27-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f8adc1d6b373dd18bec2eaaa5036ffbade7f21cf080b7b18c249b73c88709d8c
|
|
BLAKE2b-256 checksum How to use checksums |
ae2e7a8ddd3e7d6418adaaa86fdbb2b687133de7f15a2af38773b71176addefe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b641b34c186a8c246f6aaf199bdd46300e858af5aea6d19f6d8281374e93488c
|
|
BLAKE2b-256 checksum How to use checksums |
6718f65b9a1dd11fd3d60827c4d024fac1d0cd54986d47e93f051e4c653dd948
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.1.27-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e3535e4602552d8a15f5bec2751993d057bfac2bf3560af441bfc5f0ef8e999d
|
|
BLAKE2b-256 checksum How to use checksums |
5e6baae185fe12e360ffa78b8fc810ea18267855b4615ce2c52b6c305b2d6c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4a9eeaf734ece7afacc5457f8a1d6c8727fd18ebc6008657a293cfe252f56896
|
|
BLAKE2b-256 checksum How to use checksums |
927e0a4ca0b5e6dfb2c3b891f4c3f67415c8cc2dd40c248578c8e5d667d2ff73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.1.27-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
700e0301852d5085458d406b0720426e865e727ef9f0c149149173cc36e95629
|
|
BLAKE2b-256 checksum How to use checksums |
e369d234f16a5cd2c91c1347fc3cdbe958e3c8aeb64b782d818c69a63c09b764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
89dd38642e6b85cebad698eb8df053f74e9682ddfc9b71b821943e7288b0a094
|
|
BLAKE2b-256 checksum How to use checksums |
ffe6a3c5cbcdc363e0e709bcfa8c609a63884e5bbb92b3a7f0cee2ce5334208b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maplibre_tiles-0.1.27-cp310-cp310-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.1.27-cp310-cp310-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 768.5 kB |
| Tags | CPython 3.10 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
6c84019169dd579b27bbab8ec60c9e391ba0f9c36287af7d23bc894980ab1699
|
|
BLAKE2b-256 checksum How to use checksums |
395c6e54e9646e7ed67da259acc4a90799f6b43eabef5f04043379160357b3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|