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.
  • z_step: int | None - the power of ten of the z grid's step in metres, or None when 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 once z/x/y project.
  • 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.

  • 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 unless z_step is set. 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.
  • z_step is the power of ten of the z grid's step in metres, from -3 (1 mm) to 4 (10 km). Every position is then [x, y, z], where z = 0 sits 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.4.0

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.4.0
File Size Uploaded Provenance
maplibre_tiles-0.4.0.tar.gz 514.0 kB Without provenance Details

Built distributions (wheels)

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

Total release size: 24.9 MB

Release files / maplibre_tiles-0.4.0.tar.gz

Download URL maplibre_tiles-0.4.0.tar.gz
Size 514.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1e6da453c614bf91934a138fe9f3fcfab60b2fa00e30b58951bddf4a95d69e76
BLAKE2b-256 checksum
How to use checksums
4bc109a98ab3b2a87d6de0a24f9d17d0cb16d7ed48fcd934913d3318c1529c1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp315-cp315-manylinux_2_31_x86_64.whl

Download URL maplibre_tiles-0.4.0-cp315-cp315-manylinux_2_31_x86_64.whl
Size 1.1 MB
Tags CPython 3.15 Linux glibc 2.31+ x86-64
SHA-256 checksum
How to use checksums
132325dee6eb23e5e96935ad89bd828d95a6ef2e00045d0e1d353fe35f4183ae
BLAKE2b-256 checksum
How to use checksums
32daf2634ea127ebc61f5055d0b4bfbcde15c033b6f1e316e062e165fdce667a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp315-cp315-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.4.0-cp315-cp315-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.15 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
50d281ec37c38f20694a7742d725d1af73249d100f3bf4b199386869bdf10978
BLAKE2b-256 checksum
How to use checksums
63b8016a1da9402f88ebe2f817f5a2080951e974a6f8aad1acf7de7f7927ceac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0dcc3b6b93bcba128d374ffece6f0e84bec67b64b3340753a13283ea6c7219d6
BLAKE2b-256 checksum
How to use checksums
479d3a9b72313ea926f2352bd68c1a5703b5832f7c0985155cf262eccae253cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp314-cp314-macosx_10_12_x86_64.whl

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

Download URL maplibre_tiles-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b9077c79828b90993d2564b9cc53d1ec5b0f9bf75395e0c24473f2fcf0c90a2a
BLAKE2b-256 checksum
How to use checksums
7458324fa32411cb89bf028fe268c05f7ceda21c39ea0460a8120ba339eaddce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp313-cp313-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.4.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
881df0966c5ebe99e33d7f7bb31c98f2dd54a4aac63816f80ce956c5bf2e6a53
BLAKE2b-256 checksum
How to use checksums
92ca357d6976031f00701e8711c2310588bf5ab69a8c6931a25a1a510d5d51df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a1ec450d50c526cb7fd98c65ad9c91d50e84da1d63eefd94cb6a54d39ef9b855
BLAKE2b-256 checksum
How to use checksums
fceedd054fcd7141a40818e734e95648bd15cbee05c2eefc8999db6bb68f5be9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3aab373692daaafe3722be2e4095d87bda47dc8fbdad6982cdcf68c95ca470bd
BLAKE2b-256 checksum
How to use checksums
38f25ead24e4fed3d361b051b66aa8646e3607fefc59dacf681ce8b50b0c172c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL maplibre_tiles-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
719ee6eed60bb0b1d45800521eae47a5be0622f63652cdd78872765b3e81ce94
BLAKE2b-256 checksum
How to use checksums
7fb89664b586e44149fc34e8b0c74f047345fb0505e9fb00363814569513ea02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL maplibre_tiles-0.4.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4e8b4fb648da5cb27f67b5d7658a0fac61bf36bca0e28b7eed9dcb164ecb1111
BLAKE2b-256 checksum
How to use checksums
592371f47678b1f3bb8a0388e9745059ebc06804cd7077df577fcd679e8868fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.4.0-cp310-cp310-manylinux_2_31_x86_64.whl

Download URL maplibre_tiles-0.4.0-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
1d1c75136159181f0e079fb1fc3a1a0cc025ead1c70f699e91031e6b290e216d
BLAKE2b-256 checksum
How to use checksums
f8c725fdbfe842ac473862489a8e76566dca7de85c5c7d17b5a076c95199f2d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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}

Security for maplibre-tiles 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.4.0 This release

12 release files No provenance

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