Python bindings for MapLibre Tile (MLT) format
Project description
mlt_py
Python bindings for the MapLibre Tile (MLT) format via PyO3.
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)
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`.
import maplibre_tiles
blob = maplibre_tiles.encode_geojson(
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 1,
"geometry": {"type": "Point", "coordinates": [2048, 1024]},
"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"),
])
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.
Project details
Release history Release notifications | RSS feed
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.17.tar.gz.
File metadata
- Download URL: maplibre_tiles-0.1.17.tar.gz
- Upload date:
- Size: 222.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
deb54a1d6d412cb19714d0af98ca0934360efa9c8cd2553d38b27f6933f0ca69
|
|
| MD5 |
7083e48721d514d401c36391999fe59e
|
|
| BLAKE2b-256 |
ad7c62370fab8657e25212c2572d63a06637d893f2ef7a4ec979227ff8cfe830
|
File details
Details for the file maplibre_tiles-0.1.17-cp314-cp314-manylinux_2_31_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-cp314-cp314-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 718.6 kB
- Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26809d60d0fad80cdbcb1e60341c6bc97ee4e4383fc521715c1dd7a2a63fd4dd
|
|
| MD5 |
7cdf0bc6851f550fad3582b1d060a80d
|
|
| BLAKE2b-256 |
4a60efa032b743456f82d21f175ccd4aa4cdb4e4b1ed33c722b632dfd00b302d
|
File details
Details for the file maplibre_tiles-0.1.17-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5548d6bb060974bd6110bdf14500986933688c6be716ff89c83e37edf19705ff
|
|
| MD5 |
d0d38442c161d7af13430eb4c0dbaa3b
|
|
| BLAKE2b-256 |
ba477e695e1b86be36cf90835ae91717f67a9ab65f3fd64ca4410a956dc80f67
|
File details
Details for the file maplibre_tiles-0.1.17-cp314-cp314-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf0c9869560677f096c068dfa05917aef6a519de2d9c6af0d07bea4248993f48
|
|
| MD5 |
12a1b301fb2c23e4c832045079440cbf
|
|
| BLAKE2b-256 |
838e59d9dcdbe2bc755bbe22ff9692114936b0dfb7ddec803ade50a35b5b5178
|
File details
Details for the file maplibre_tiles-0.1.17-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d65b35cb2f37b75ca0178750b6faeed178257c1904af218cb075cba7e96a201a
|
|
| MD5 |
13deb646a150e96d51089102b404c62e
|
|
| BLAKE2b-256 |
12c71e31aff18c327f395272e76dde63e8ef7311d5d875659c82cf6c7a6a29df
|
File details
Details for the file maplibre_tiles-0.1.17-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4fad1926625b1c396892c2cbb015b53418ec726fd0f49b9c2d0f0c3b3632f43
|
|
| MD5 |
2c6322d9d48690583c855a5f12ab84a5
|
|
| BLAKE2b-256 |
e393d95032e032cfb5d1332b05db46ad4ef6e5b9f6a44a9f0569ff534bbfa767
|
File details
Details for the file maplibre_tiles-0.1.17-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6cd396fb02f873b27b6f6a077a8d504c42f33ddcfc19db6e965b814f67a5658
|
|
| MD5 |
64fdc4b107fe9ee81a4696104ae3fd1c
|
|
| BLAKE2b-256 |
b3ac03786d73bbeef6903429ee5d004c17b0c7741fe54538e114095865b91294
|
File details
Details for the file maplibre_tiles-0.1.17-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4a663e95d2de6d0e81e91e122392b189402acfa72c00dd41c5d54f87e810b18
|
|
| MD5 |
c13ddaf72deeccf35f0667df2ae31876
|
|
| BLAKE2b-256 |
d2d549406dcbfef4c6bd3cbe65e8f228b8150890a890a3e877eaf7fa4d705e7d
|
File details
Details for the file maplibre_tiles-0.1.17-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e214bb32fd1d7f25e60af6c69a121ebb87b7bd3be2275ad406d567df301bda0
|
|
| MD5 |
e8aaaadbe3bb138fcfbfc22f085cefb8
|
|
| BLAKE2b-256 |
063830c1a203cd189ada6b17152a5675cd66b2dfd187b3ec90a28a27607ca380
|
File details
Details for the file maplibre_tiles-0.1.17-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-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.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e9812a813d32f0af256cfddfda2951836745c9ca5bdbecc1c2ed8680782e254
|
|
| MD5 |
aeddc791b0518d538a88cfb2ca2f585d
|
|
| BLAKE2b-256 |
932ad94899510c1a2c445d94da9aeb503fca670fe8620afd5f5b9b1272626191
|
File details
Details for the file maplibre_tiles-0.1.17-cp310-cp310-manylinux_2_31_x86_64.whl.
File metadata
- Download URL: maplibre_tiles-0.1.17-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 723.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c1dc06566a452ffbf8d3e6c8e789e66e1a926f3ea2a81678b563fa5eacf173a
|
|
| MD5 |
51abe2a09fb298fd31d561f2fdb3693f
|
|
| BLAKE2b-256 |
4e29c015773724b48c74125af8b27b87b90569ca1847bd7b347ce4f1d1c5437c
|