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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maplibre_tiles-0.1.25.tar.gz (235.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

maplibre_tiles-0.1.25-cp314-cp314-manylinux_2_31_x86_64.whl (771.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

maplibre_tiles-0.1.25-cp314-cp314-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

maplibre_tiles-0.1.25-cp314-cp314-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

maplibre_tiles-0.1.25-cp313-cp313-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

maplibre_tiles-0.1.25-cp313-cp313-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

maplibre_tiles-0.1.25-cp312-cp312-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

maplibre_tiles-0.1.25-cp312-cp312-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

maplibre_tiles-0.1.25-cp311-cp311-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

maplibre_tiles-0.1.25-cp311-cp311-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

maplibre_tiles-0.1.25-cp310-cp310-manylinux_2_31_x86_64.whl (772.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

File details

Details for the file maplibre_tiles-0.1.25.tar.gz.

File metadata

  • Download URL: maplibre_tiles-0.1.25.tar.gz
  • Upload date:
  • Size: 235.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25.tar.gz
Algorithm Hash digest
SHA256 ba07a156cf7f89fd79f90d6dcedd565dca2417a8ba1d44e362f63a00401e6776
MD5 a43fb29dc6ed811a28f104b39580c83e
BLAKE2b-256 c0bf74f04402268419542486d5a0cdd463e36f97a1f6365b012c37275daa7830

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp314-cp314-manylinux_2_31_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 771.0 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 856337a1da5f7f58d8a29453403734452d27fc5dc16bc11c6598d3346d46f688
MD5 9de807f887266108ba4ba039c72d2012
BLAKE2b-256 572c8fe9da60b61a25814dbb58d1e1ea7e1949d2583c57a64473ebaa22ea0366

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a00e36747a05ec86ca51be12e59340cc5d2a28d8033cc783b88189723fc213d
MD5 3238f286de77f66e9eb90d78cea2954a
BLAKE2b-256 39bb206b6b001e5ff87420bef6609e32ae02812859c6e404e2dd5e606a941b4e

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 60e58b3accbcfcff16172d3e1be38ab2d0438f81b278a76c6fbe883274a64495
MD5 f4e7737bfd0de8ba4c654263302a4b66
BLAKE2b-256 4e729c714ba319e07c1885161735ff89c825d7788592876971fd59a0e4a2fc34

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fa655590d8da9b0f24f1335a6a60a7ef65dc5a5d864e3a79b0428705a6ac9c9
MD5 3614c2681e8812f0ae9dd9057b756471
BLAKE2b-256 e8d69deec4d60243eb52407b791b982e9d201ab94a305abba82e1e0698e2f27f

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d5f7c05e123362d52c5fddf26feda5c0c52aebd51010acf5b33b2ed8e2d850ab
MD5 5fb150878781052d81e84402c3d2aa0a
BLAKE2b-256 3f9b3af1d2d8b7311b439e7eb8f338972564773ca2942f439f47e9b0faba1ff7

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 30d29b77955cda42b6007f947ea3b939320b05f8392decc60fef1f8d779de684
MD5 bf6e56f8288bd7e093aa74562f33dfad
BLAKE2b-256 f9cf09db4e279f8edf35361de8f654d2cf610fb08e8719d2e5e196b4cd2e63c2

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6296101bc6557898bf4714777d6d86e74497bfae3a386cc5449a777a9c7b1c85
MD5 8ec36f0be32a4e3336cc14a30c878614
BLAKE2b-256 4623863485263afba174dd61a776eaa47d7491b6b5348ba4720824fba488f952

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53936f7871581cb31fbf43172c29ee1901d31aff860d72e696eabd4db72fee88
MD5 c645d12c938f3eed101a07cf0f9d82ba
BLAKE2b-256 7308fd85e031c570b23b041cf3e011088d68f81168b0982a31456803e4ee639c

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-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.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c24361cb9c05cf0a34ed24865773cf9c29e3ddef55d7d202c80717b064a6710
MD5 a12b3aa0cb688410f0d136a8729cfe7a
BLAKE2b-256 53e4eea985cb3b441fd6e744e14556f5e7a841ca74ca5394b09f7bb777149652

See more details on using hashes here.

File details

Details for the file maplibre_tiles-0.1.25-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

  • Download URL: maplibre_tiles-0.1.25-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 772.3 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for maplibre_tiles-0.1.25-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 09a9b7e66fbf4982cd334ef3b2c51aa8de56fb45cc60bf193c3200838b1732e1
MD5 0ac89bd80647458559b3270eb4a8092b
BLAKE2b-256 8ea6f326feb37c38cc3ca4fb6a2d92a3f9fb7ed887084f08bf08fad31dd71fc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page