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.2.0
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.2.0.tar.gz | 419.9 kB | Details |
Built distributions (wheels)
Total release size: 17.5 MB
Release files / maplibre_tiles-0.2.0.tar.gz
| Download URL | maplibre_tiles-0.2.0.tar.gz |
|---|---|
| Size | 419.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1ccba0d13e309a9003943c9ac6415f3bd8df3e3301e5683ba593a53d2f79d4b
|
|
BLAKE2b-256 checksum How to use checksums |
14c48f61ccfc6cf69e8394b6e6863a30938510731423e9a9c2ad8bab42a67a64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp314-cp314-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp314-cp314-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 776.6 kB |
| Tags | CPython 3.14 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
31e07f556f2afbbec7c7282c11efe422cf876f4bd9ef0c8c8f3b9b85ce63f759
|
|
BLAKE2b-256 checksum How to use checksums |
93a4db5d32a475e6dd16fff09f0dcebcc8b5e3a3294b8ff70a7543344ae05061
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.0-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 |
d29db2446ab59632f9c9ef1fc858f9d4ac1b7bdf13f561eadf3369960e8a943a
|
|
BLAKE2b-256 checksum How to use checksums |
8a60edec3237b7881808dd61824c817362ad9f8c2eb72c958217b85271b5b445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ab645bf0b54b17d621844333ace398a602a501112db17bb3f534a3bde5f3362c
|
|
BLAKE2b-256 checksum How to use checksums |
9a06e5101d8cb34e0b3c81250965d45ab9184f14fd1c8114ef380ba77bf982dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.0-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 |
abe0bec5cf1c19b0d4edc3ffd1761cbfc7cd7eafc997fcdd3fb064dd14ab11b1
|
|
BLAKE2b-256 checksum How to use checksums |
ad9b4ee2687c8037013e173b6f5ea2e109c0e6b7bc6b6f47e640ba795f561b75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
11cb3810e0d2c2be271e0fcb9dcd28dbcf4fac153fa30ac993982f192daed8e7
|
|
BLAKE2b-256 checksum How to use checksums |
6f35da447dc46da9b1cb13b9ba97bdba4599ac0539eec20f8760f309a071bd57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.0-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 |
05f3d8edfe86c984d3c8dfb51bbe7b5e5c93a7c6c77f88890486733731fbf61a
|
|
BLAKE2b-256 checksum How to use checksums |
9fc389f4d0dc3db348b917997e3dfb672bf6533b326ad2815c83371951196f67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
135edd277f2de88edd6fae56417e20a0357b524890ed27ae06af61886751b7c1
|
|
BLAKE2b-256 checksum How to use checksums |
f6039949cd77108bbe1022572296f74ad8fb989167a9931a82a1e17ab157f9e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.0-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 |
3181072889724abb34bef72427a4f4449bc809d797363e9c9461666fc0a1b226
|
|
BLAKE2b-256 checksum How to use checksums |
42e283305290acee027129ad5a8db498d54333a13677f6c304e4f3f736fc4bd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
74c5996c0b2de62ceb3b7713434a1809767c859ea3f3c2e6cc9223e9e4790f41
|
|
BLAKE2b-256 checksum How to use checksums |
828e30daa15743253f0fb3dea6aa0e4259c3a6cc54a22068232b007524d035da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.2.0-cp310-cp310-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.2.0-cp310-cp310-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 778.5 kB |
| Tags | CPython 3.10 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
18415ab87cb10c9e4b594be5efa0bed1ea5dba7a1f849dd680b199f82c0336a7
|
|
BLAKE2b-256 checksum How to use checksums |
dedc69d2f7d7536f1eb694e19374985fbac6928835661701f602e42c7636ac43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|