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.28

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.28
File Size Uploaded
maplibre_tiles-0.1.28.tar.gz 276.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for maplibre-tiles 0.1.28
File
maplibre_tiles-0.1.28-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.28-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.28-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.28-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.28-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.28-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.28-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.28-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
maplibre_tiles-0.1.28-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
maplibre_tiles-0.1.28-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.2 MB

Release files / maplibre_tiles-0.1.28.tar.gz

Download URL maplibre_tiles-0.1.28.tar.gz
Size 276.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e58c38a933f17a8478bac153e6b3ea27fc90a9c3043a12b2e5f26a8b3663f108
BLAKE2b-256 checksum
How to use checksums
3c4913aab00484ddc4483c86e3b58be45d061855b802639e04791494d3255219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp314-cp314-manylinux_2_31_x86_64.whl

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

Download URL maplibre_tiles-0.1.28-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
06217d71318419df7914ecc5e613540b1f2aca54735d7ff701fd65fa9e0f7a9c
BLAKE2b-256 checksum
How to use checksums
8b265d6fac5e151bf115d51350588b7ba8e334b2cb4cd3214ba763acf38bd1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp314-cp314-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.28-cp314-cp314-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
edd2d782c929e5a63fac35198d393446fd3068698a11603646cef4894d0bf364
BLAKE2b-256 checksum
How to use checksums
c6c3b759a15a760d4c22690324f75da5549c160b275376176356d0cf9aa4cca7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp313-cp313-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.28-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
fc73b319be596db3cddccbdc4c3ab101a958f956759c65f50ec595d5857aa0c8
BLAKE2b-256 checksum
How to use checksums
317eea3995c62d71d89f03683b8e8eb3e4882e4feb71aed8998357635eb8d519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp313-cp313-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.28-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e65a29d1a769e89091e02c330940d7d1cbf508eb2e3e1a46bd21f407196aea8e
BLAKE2b-256 checksum
How to use checksums
47caf7bb01c6b053363fb060a6895986714e6f460265c21b55c54b3de6129aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp312-cp312-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.28-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
20770cd7b907b8cabdc471bf9fdc6d88d6a2207e36db26601c1ce0fd621d3270
BLAKE2b-256 checksum
How to use checksums
883d481d408570c190471fabb7c252ac8f83a90bf568b4ba337ddbf41a3151fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp312-cp312-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.28-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9a1e03f83e3e769a6202511c8da13e32cb36a504cedc475d08d9c244ed6ee40a
BLAKE2b-256 checksum
How to use checksums
5afc76e73220ab016d35b0a4bd16449157f7a30760fcc3485905cf0e52536957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp311-cp311-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.1.28-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
4f9b9c1da79daa084235cd6e1fab0eb9beaa8716ecbfda0fb26ef88fb281a9e9
BLAKE2b-256 checksum
How to use checksums
c98b56a95aff3d18e8726a909612462c41eb1e522179d9786116a9b030e5fb1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp311-cp311-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.1.28-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9b651b31fea1ca1c2929929ba0fbc1460413e995c42734bb6b50d3b212b01515
BLAKE2b-256 checksum
How to use checksums
b51b6819e6cd5e9738e1ef396222107f93ba96172b7c1b938b1fb34266f62b4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.28-cp310-cp310-manylinux_2_31_x86_64.whl

Download URL maplibre_tiles-0.1.28-cp310-cp310-manylinux_2_31_x86_64.whl
Size 769.8 kB
Tags CPython 3.10 Linux glibc 2.31+ x86-64
SHA-256 checksum
How to use checksums
2ea00d002ec2814ed81ce58fa308a6c2cf73ed54e096a211421abef105cace1a
BLAKE2b-256 checksum
How to use checksums
49eef321d185e20a1b53d3fae3e9759a45c43aac647da92685f1db22fa9f6a21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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