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.23.tar.gz (233.9 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.23-cp314-cp314-manylinux_2_31_x86_64.whl (765.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

maplibre_tiles-0.1.23-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.23-cp313-cp313-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

maplibre_tiles-0.1.23-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.23-cp312-cp312-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

maplibre_tiles-0.1.23-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.23-cp311-cp311-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

maplibre_tiles-0.1.23-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.23-cp310-cp310-manylinux_2_31_x86_64.whl (766.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23.tar.gz
  • Upload date:
  • Size: 233.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.23.tar.gz
Algorithm Hash digest
SHA256 eb47baa9e109126b96a929857dadda7a6ed36530df83d0e42dbb6ca54697329e
MD5 799e94d3470f6d0d50e3729536f66fcb
BLAKE2b-256 96397d9ded7500a7f92d41d12aa04fceeda0262cbf19e82c2f960ab11020838b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 765.1 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 74a000700d1903f755005202a6e3fb3a5e2b9c6ffff850c219aa4e5e5c8bc347
MD5 6c43dcec53ab9b77b3127fa466e45801
BLAKE2b-256 6c67fdb68d25571304313f0569685a0279a994753cd5211f2ecf5b2b8498d44e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 adf8bcaea9ab1e0c9a0e10ad2ddfc2112722a8ef43cfe1adc00850db5fa90088
MD5 5ea515ec67cda271ef1085f17f843630
BLAKE2b-256 b4ca3da4c19a296014632db28fcbfc3382777e6ed799c95953ef21c0c1375703

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4708d6b10053d3184f2bc34b699d97305b62fc8dfcfc140aafb55e774379fb23
MD5 fe4cf7245b710e41c98a550c3f704761
BLAKE2b-256 258f1c863cae2da39f3464d5cf84135010f3d99291b398ce674703352cc59eff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f575b4601b927835619f3a5da6c30afc6325073b61e571119a8947926c7b9293
MD5 a0454836872b75b66a50557125d198ce
BLAKE2b-256 88998de943edffaaaedefc98ac9f080a5376754bb0af1af75e2c79ac282dbad0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c6565b0b66d3496b4d0a49be89312f49cc9af074efd456ceee23663ab71b26ff
MD5 e39f094f6ca187d1d5111e954a8886cd
BLAKE2b-256 fb4e9e8ba5160c50ea9fcf2228a4bebd97c3a21f685cf59552ed330e61613000

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab1dc0509e13c9e8d7991de80852b2ab7cfca110003f4729516f698c275974c9
MD5 c40f1664fedc0e2337d945ccdfb5794c
BLAKE2b-256 9f8ebe93be73e95fd8f8cc66e54cfe53afb4affe9542968ef9d88b06d6ae1515

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 07f9cae2f492a305e52a614df043ac13ca701966d429ce6cd956f8c3c1b0d462
MD5 b0ff071487cddcc87aa84025f0ae61bb
BLAKE2b-256 d2a8b18714af7f00c8bdb46256b295af265c58ef2441c650fc7be688912a9558

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46114cd3187742ddca3091e1eea8efb68d65396fd9f00d4813a760c4be4fa1ff
MD5 caaee4f54c5ed194517b4a2f62e4614e
BLAKE2b-256 bb02c766337e1ec444a75b89ff851cc0f61d5d281356535cad71f5a872e362b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-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.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2c901947b30f7c39fe7d08e09fa783a2712eaf9c07a03c2f0e2cdc7892ba3efd
MD5 0790495219e531fc9d66b8e4bb89ed61
BLAKE2b-256 503e00cd3e63004a607a462fb93fce6530fdae4f4756f2e0fe856fe17c2d21a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.23-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 766.6 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.23-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 867c335d417c16782a0506a2f09641259da767a4e9e9209814837c4efced99bf
MD5 3a1553fb16f9b6c15afb3d2706218da5
BLAKE2b-256 d0ec2e48ba5be9d974bf42144184a921dec58747f9a636d1d87962bb80e4f4e0

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