Skip to main content

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.

  • geojson is a GeoJSON FeatureCollection. Geometry is in tile-local coordinate space (no projection), matching tilezen/mapbox-vector-tile's default. Coordinates must be integers and 2D. They must be JSON integers (2048), not floats: a float-typed value such as 2048.0 raises ValueError.
  • name and extent set the MLT layer metadata, since a FeatureCollection has no slot for them. extent defaults to 4096.
  • tessellate generates triangulation data for polygons and multi-polygons.
  • sort controls which feature ordering(s) the encoder tries: all, auto, morton, hilbert, id, or none.
  • shared_dict enables grouping strings into shared dictionaries.
  • fsst enables FSST string compression.
  • fastpfor enables 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.35

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maplibre-tiles 0.1.35
File Size Uploaded
maplibre_tiles-0.1.35.tar.gz 395.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for maplibre-tiles 0.1.35
File
maplibre_tiles-0.1.35-cp314-cp314-manylinux_2_31_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.31+ x86-64 Details
maplibre_tiles-0.1.35-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.35-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.35-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.35-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.35-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.35-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.35-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.35-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.35-cp310-cp310-manylinux_2_31_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.31+ x86-64 Details

Total release size: 17.4 MB

Release files / maplibre_tiles-0.1.35.tar.gz

Download URL maplibre_tiles-0.1.35.tar.gz
Size 395.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d5c0dca7578fa9299b147c60039cf5cf01888427514eaaf21a90d660651bc303
BLAKE2b-256 checksum
How to use checksums
f5e0038d2bbaf7848d4afe86564c2d851f23cd65b096d98871218d99068871b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp314-cp314-manylinux_2_31_x86_64.whl

Download URL maplibre_tiles-0.1.35-cp314-cp314-manylinux_2_31_x86_64.whl
Size 775.5 kB
Tags CPython 3.14 Linux glibc 2.31+ x86-64
SHA-256 checksum
How to use checksums
ec16bbe140fb9de63a8b5a60f1cb5cf2cde9c0c3be05be902827bdba250d357a
BLAKE2b-256 checksum
How to use checksums
60ba884b4a85d341e90b592bedb12ee0695d1b789a57ba20322489bd0ac41082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp314-cp314-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.35-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
f1dd57e99b521e85c4a174660053befeee36f207eae823029902938bb6dd0e03
BLAKE2b-256 checksum
How to use checksums
dd84f5f89dfaf1637e06f0240c914fc2ca3e541922e2c489ecc6800ecd58dfac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp314-cp314-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.35-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
fcd05892827e876ec12f19f2c49c601201cd57317fe7633fd8584f1e7e1087eb
BLAKE2b-256 checksum
How to use checksums
dbf33fe9a69529fa7a3780ef3303a9db2c598a7ce5a4f057e832b95eb30205c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp313-cp313-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.35-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
26ada0a297d1838800498cd6e9438a49c4562c9da32d51a6741ce01565462fd3
BLAKE2b-256 checksum
How to use checksums
53d7366749a0c152366b27f0ea9f8726f2ce83d2d0920c4db0bf28a49f454468
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp313-cp313-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.35-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
f75d7ce08ab8ebbf0aaa6a3e1f7fb5e28ec72ed98a3eb6ef734b7bbae28b8ee7
BLAKE2b-256 checksum
How to use checksums
6a3b202ddd47b28db2965efbf477799643eadea76cdbdb6fabab3ce73fef6c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp312-cp312-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.35-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
5fd052ba31bba352d4b0e0e689f7e0fc2400419993cb4792896766fc9d447191
BLAKE2b-256 checksum
How to use checksums
1d439ed22f66d4b599585356873bf2931822845fa4472e5dfd5300c0249f6a46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp312-cp312-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.35-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
fcb998131b0996c99311337f397edf1f31af0e40d548ba3e3fce227261096298
BLAKE2b-256 checksum
How to use checksums
30167d3e54b7295bb2636d2b1aa7ea8df0855390b9b0b82b19cc8e1d2655ce6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp311-cp311-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.35-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
1141dd815ef94b6e88b74f51f475e529c1b590e4d558a6fcbcc422c58414fb44
BLAKE2b-256 checksum
How to use checksums
3e57f2a31a1a2459689b54bc92dc946ad13c1841b319ce2af415ef3a6f1fcadc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp311-cp311-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.35-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
c1a13c5c0e88a67fc71bfc90f54048886b51f854696fd1763f83c6d6685e861f
BLAKE2b-256 checksum
How to use checksums
77a3fa1032337ee0a1da15a7b4a04ac347f073a8a1b250067a2a4c5aaa0c5423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.35-cp310-cp310-manylinux_2_31_x86_64.whl

Download URL maplibre_tiles-0.1.35-cp310-cp310-manylinux_2_31_x86_64.whl
Size 777.0 kB
Tags CPython 3.10 Linux glibc 2.31+ x86-64
SHA-256 checksum
How to use checksums
0d49ec41808dccb150f750b469b91e10231c33cf121e29722914c97bf2078442
BLAKE2b-256 checksum
How to use checksums
6415aa52e8c199ec013e2ee0ff1c8c711ce24f5826d710b1f5fc692fec0052eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page