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.z_step: int | None- the power of ten of the z grid's step in metres, orNonewhen the vertices carry no z.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. A layer with z writes ISO WKB Z, with grid values in tile coordinates and elevations in metres oncez/x/yproject.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, z_step=None) -> 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 unlessz_stepis set. 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.z_stepis the power of ten of the z grid's step in metres, from-3(1 mm) to4(10 km). Every position is then[x, y, z], wherez = 0sits at -10000 m, and the layer is written in the experimental v2 format.
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.
Metadata
Release files for maplibre-tiles 0.2.5
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.5.tar.gz | 466.4 kB | Details |
Built distributions (wheels)
Total release size: 21.5 MB
Release files / maplibre_tiles-0.2.5.tar.gz
| Download URL | maplibre_tiles-0.2.5.tar.gz |
|---|---|
| Size | 466.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2081f028abc3bcaf7dceabf410a990c9b97237243d3ba7f72e72cbd10b753a7e
|
|
BLAKE2b-256 checksum How to use checksums |
dbc5bedf00d7bd14a9a814dd6607401ac4e44dc0323f771e81c078b9822af13e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp314-cp314-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp314-cp314-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.14 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
00acfce578eaa1556c629e2c4809bb4919149eb52d702a4362ba5a6b0784a418
|
|
BLAKE2b-256 checksum How to use checksums |
c23e90be7f1b1f88abe3d1f1aed3aa01fe56971470dec61fa73d84b286dcd668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.5-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
68d981af3b19c8ccae82bf7baa54d76a5a038e2bb2ac8c66eeb0a4d27dab188f
|
|
BLAKE2b-256 checksum How to use checksums |
8eabf1fedd58d4fdb14cfabf94ac09ef5b85e0eee2913a7b4172da8c184c6b44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0f315a25785a1a73975ccb2866cece2fe0a0d034d0c126a6a16fe1d293d374cf
|
|
BLAKE2b-256 checksum How to use checksums |
42bdc5f89ab938c9f79298f22cf02a464b2f69433277a1621a56d1aeb6aa6a77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.5-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
41fcce7db69be238a27eb50d5dcfaa9cbf828e3f73d7377bb377393df0adc745
|
|
BLAKE2b-256 checksum How to use checksums |
437ac4867e8abf7adcd095052818e242aeb7ee32f48ff7e9b3992297e1a35a29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
459d424c2d06bd2572def8aaedbbad1f1d07c8216b8a2f6951cdddd1a204e6f5
|
|
BLAKE2b-256 checksum How to use checksums |
384b37f7f132f5f2a43bb0638776410778674b0fac765d556d252830d3bb95c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.5-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9a439b9c4e5f97dd3d0ca2c7e3e9b9ebd88102fb9e046ee17b2ee2052765da28
|
|
BLAKE2b-256 checksum How to use checksums |
85601e8e6e0a3daf4dccc85a549d886eb07ddf5d05cf811c84997f69dcd3659a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
162216b94fc000b0967be5509dbcfd2e8157d257fe4863531909324388c425da
|
|
BLAKE2b-256 checksum How to use checksums |
310b6f14a15892fbdf10c0ddde231663ac71691ec6298480ef6ca8ad35c78e46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | maplibre_tiles-0.2.5-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0f9480c264fc469b4823bf95a53e4fb799a7c598a236fc2fa8485b9e4ab22820
|
|
BLAKE2b-256 checksum How to use checksums |
d72d761e22969e73e5c23409e6381bbca9b53f9452405d42ccdff6ba5068419f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
50eebdb8bde01b50c152e12ef1930b3e46ebf93212dd474dae555a8e89828d0b
|
|
BLAKE2b-256 checksum How to use checksums |
d39e1902b1e5641a39003103739d0d5cd5f8b80a1b5e363ba2c575fb253b8599
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.5-cp310-cp310-manylinux_2_31_x86_64.whl
| Download URL | maplibre_tiles-0.2.5-cp310-cp310-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.10 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
da680e24bb00c098a03c7d6cc7e8831621ba08a2026f3eac4b7f981e3718bd27
|
|
BLAKE2b-256 checksum How to use checksums |
fdc9fa0764090065ac8f30813bfb0180668337b5cc699525072516ecfe84d896
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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}
|