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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maplibre_tiles-0.1.24.tar.gz.
File metadata
- Download URL: maplibre_tiles-0.1.24.tar.gz
- Upload date:
- Size: 234.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
673e27b886fd6ced449ef5459a52f5a6ff43f5b4c110352e4a63595414437c64
|
|
| MD5 |
6c08a25b8d087b9130d005f9ab2630a7
|
|
| BLAKE2b-256 |
836421d5f069e0b46565f1c29faf9f1a56e290981afec66e1cca59ffba76e08b
|
File details
Details for the file maplibre_tiles-0.1.24-cp314-cp314-manylinux_2_31_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp314-cp314-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 765.2 kB
- Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcf89e5194e0fb67434e7a27a2febf9d9213404cab06cccc9da8a03aefeffcf
|
|
| MD5 |
39700093f66ff6aa302d1b479561e415
|
|
| BLAKE2b-256 |
eba322f45b7a4ec81bf4cd61b991683bbabe4a5d9d7c841d4c21be372f8c5a17
|
File details
Details for the file maplibre_tiles-0.1.24-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bb10b474f5c8296305289670d53998b70b81f822a3bc0a5d212bd2c34680b6
|
|
| MD5 |
ea9db4b19e41b7d9008861e216f70a24
|
|
| BLAKE2b-256 |
61d9e803d81bd93702b033214ebca846c4a9874214f164af6e09d1a14c095d45
|
File details
Details for the file maplibre_tiles-0.1.24-cp314-cp314-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp314-cp314-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.14, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf1245d1a3d742d14481684d74bcd0305168d2fa1a88723cbbc2f021ff59b5db
|
|
| MD5 |
cbb69ec7e77f1d94361b0f8320f4a13b
|
|
| BLAKE2b-256 |
a82d3287acfa5f5ae98fe7b4118006b746f9a33d00f0a1478158e1c4093f481a
|
File details
Details for the file maplibre_tiles-0.1.24-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbf0aa88d2fa9f85ac3a0bb0bd46bfb5c2c43904f571d075d97a185c8b90a3b0
|
|
| MD5 |
6b92be5fa2aa45e4aa2bb6d03f48c18a
|
|
| BLAKE2b-256 |
ae2e328a0c9debcab34bae45fbdf8d0a6a9cd3283ee063e973e9452a24413f0d
|
File details
Details for the file maplibre_tiles-0.1.24-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
028bea58615fd7be91594b6c2902d4d22be4410281071e4f496ed8911ab9a7f1
|
|
| MD5 |
7d28320fc1219438742203260bbe7802
|
|
| BLAKE2b-256 |
555579c4b1b7739157bff844235fa66930cf288ac5b7b981aee49cb4fa485608
|
File details
Details for the file maplibre_tiles-0.1.24-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e95c0a71db31ef043eb64b0645a5a0efb139e65dd1970ae73518f163a2cb5562
|
|
| MD5 |
4d64432f548296f545d3b171c9c4befc
|
|
| BLAKE2b-256 |
8f4f61d0d777cdb1ab7b6dd14a10ecdc854232c0c1dd0081d8dba41e3c5ba81a
|
File details
Details for the file maplibre_tiles-0.1.24-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b38d5ae2f64aae1eb5bbd62d42917529f98beca2b17850cc5d672149ea07c6e
|
|
| MD5 |
4d01fdbf5185a3d6f3fb794b29b837fa
|
|
| BLAKE2b-256 |
f5b962b057668df74abc78fb1cc5245c37637ae692d1e4e2d56c759133eada3d
|
File details
Details for the file maplibre_tiles-0.1.24-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4edb1ab60a12b1ce66286c6d77a7ebb950edad981e3d3168a5992440641f16a
|
|
| MD5 |
124fb0ff46ed7a9a8e428f078a8674fe
|
|
| BLAKE2b-256 |
c051eedfd6717c85cb434edaf3bbf70f33599a65bc6abf163e19b29d7b8a4e15
|
File details
Details for the file maplibre_tiles-0.1.24-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b131dc2640de0aa3c065770b75c86bfa0aa1759eb9d441db48fa45d06a15db4e
|
|
| MD5 |
ebe27ec334a051bdeac5791b117ad907
|
|
| BLAKE2b-256 |
0dbae771502af2354e4f7966ae44c1ecfef5027f61e4485fe711e4313e3c5ebb
|
File details
Details for the file maplibre_tiles-0.1.24-cp310-cp310-manylinux_2_31_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.24-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 766.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c3df516c1e14a099287c8cc5e2635473086b66b9f322c4c43486e1807a83da
|
|
| MD5 |
0f482884ad7f87e284f1efbf572dcdf6
|
|
| BLAKE2b-256 |
614c3b93370d9d842fb6d1beddde17b5aeb450079e730216655dbff106865e59
|