Skip to main content

Python bindings for MapLibre Tile (MLT) format

Project description

mlt_py

Python bindings for the MapLibre Tile (MLT) format via PyO3.

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)

Encoding

encode_geojson(geojson, name, extent=4096) -> 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. extentdefaults to4096`.
import maplibre_tiles

blob = maplibre_tiles.encode_geojson(
    {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "id": 1,
                "geometry": {"type": "Point", "coordinates": [2048, 1024]},
                "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"),
])

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.

Project details


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.22.tar.gz (230.6 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.22-cp314-cp314-manylinux_2_31_x86_64.whl (760.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

maplibre_tiles-0.1.22-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.22-cp310-cp310-manylinux_2_31_x86_64.whl (761.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22.tar.gz
  • Upload date:
  • Size: 230.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.22.tar.gz
Algorithm Hash digest
SHA256 4e6ec4a9b8c8ccce54020a890e59499688a457c57eb13415d7d5cabb4a9fd03e
MD5 a5eba861000e5296fe44dd3734083d13
BLAKE2b-256 e5be6590ddf33f42bb094d3851656f5f37a9504d1dabde598252d6641ba4a79b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 760.1 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 6d6a041c3db859528ee59f882c025f3da38a503e6cc74942cc698100dc6bb13e
MD5 a1212d01c022b494331977df8b518a9d
BLAKE2b-256 1c15ebc381873f6d381c5e1515ae9ef5c112d41916bf6ea4505b69aac9362780

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90a4b212d727e4f1b393c0e4533c9bdb5e84710800fc468e366f0a057ed87484
MD5 9da7e8bb552ea46df9178418c7d9942c
BLAKE2b-256 90828ec7fb79085508b00a5a30db16286a93ac0920c8f2774d27ca0814cd05ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1424c77823966588715e7ddbe87cf58d717cdf59eecac7c163bed571c2aa85cc
MD5 cf7b61225985e205f64a504e0ecb8a23
BLAKE2b-256 debd8682ff6ac06d3482bc75a69f606714e23cb3d949935564eb9be18e83e5f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e977e901ac30830acc3f2e2d272734717ed7d6ce362141a50867324f8e5595c
MD5 a2e4da01ec328cb5af9481b20d8c9dd1
BLAKE2b-256 2c23d0ffcc394bdc4f8768b444273763809380090dfe7ec70da8e69ce3b505bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 86562c7dd69b7302e9d0a0b49f821ed98ff8ebc1cf8e4f8cf64d3c14a4b0154f
MD5 9622a7990883120c5f0a81409fba9b64
BLAKE2b-256 269737686676a3862c8fc6f9368e194d4f1c9a6cbaa8ba90c7a48057c34b8283

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9f6ee2de942018561895c84402e2b9d079da02ef3f8766d3aba602497464161
MD5 776f449dd593090372f2011438181c48
BLAKE2b-256 9bac552cd918d8860025c4921d7cbf2505ae2c45c0530f636be302bebf6ddcea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ac48669cf7c9be464d181502126c444df6387affc922d35514d0010b52ad4816
MD5 7987538097ad4883b582b97ab395c783
BLAKE2b-256 f4a16e61ce63b2e64b1d15c26b323712d3ae03584cc124a31a6d9bc55d3277f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ea23d704ad539155067d5dff42f9f07871b1a98a4cb4eba7af44b4c8e6492a0
MD5 ebf7a2a7af6dfbf92792f5f7544498bb
BLAKE2b-256 56228c60aeb8598c61caaddb16eb000fa3d45f6a81b3bec968a0c32053bafd12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-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.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e5d23f6e83c675c54878484917002b8bc00522c4cd90cec3dd2023f74e9923ea
MD5 d6866513df2c016c2d1f397d7b698acc
BLAKE2b-256 ee413c08dc218aa2c94f61e5a4c1c867f2e4d15410552d1494492e6868106889

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.22-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 761.8 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.22-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 c72579bb2ef1f2e12421b4e9301138b8405f916a4bc68f69ae61a4c153f4caae
MD5 23e9bf3673e7f37722295fc0134e4b29
BLAKE2b-256 e3cdc7628b17a4a5e26ca035634a31b7b4976335baf9d79068ca1e57bfeafc63

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 Pingdom Monitoring Sentry Error logging StatusPage Status page