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.20.tar.gz (225.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.20-cp314-cp314-manylinux_2_31_x86_64.whl (750.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

maplibre_tiles-0.1.20-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.20-cp310-cp310-manylinux_2_31_x86_64.whl (754.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20.tar.gz
  • Upload date:
  • Size: 225.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.20.tar.gz
Algorithm Hash digest
SHA256 39bb160ad6c6a7d8bbae69b6a076a0f897a5c83ea6d6badc74bda96b723f0df9
MD5 0ec95566b7be041c418b83fbfbce9572
BLAKE2b-256 22cc6afe9cba16c1be20f8fc4cc1e981380c8752479669f55e62c34cf5a6687d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 750.5 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 0858f13af4f6c466d6c2eaba49a0f7605405136ecffca8bb0f314ec328581817
MD5 7139e528518404d53f2ac365638e2083
BLAKE2b-256 936300888230088ef555752484921bb170864dac1bc3b667ee943d963c1e1c55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c8c6e10f0dacc0e499a47e005d94c9f43d145bf2a7eb88af94d9ad805b07bd5
MD5 7f9a89c8bd976e962048ed9470310c71
BLAKE2b-256 b454fc77a5d7dfff80d69057814f6ccd9788fc337124a5ed8671b1c4fc24cb5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 63c24399dc6b3ea26cbce5bed13001cf3c777368af968434c5a3345403538b84
MD5 821bbc5c15957fcbe4be5f9000309c1d
BLAKE2b-256 c50b20eb82918fb1a6af031f47c7f2103a70f544f457e18664246a5536832114

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7eb27abc5c8446aa32bd71914695077b3f884aa5e1ff8cd25e7d0c9e7e6c12dc
MD5 e04a71825b1966daed100ce6a05fa4ca
BLAKE2b-256 449ec391a1f626740ede2ed10fa14cbdf90546e3bb4b276de898a285c42cda35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5391871f004da61e9f5a2be73deab458feb440e11ae13a435ce5ef22c892f6f8
MD5 9ed2343e65195be81ad0262193e432fb
BLAKE2b-256 2a7ec05aca068fc20c2222b2ddab793e377c2a4af795781cff9d329e6475e943

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce7b32912e24e25452f32ee0123207a0c31c63c06531d140afb1953e14897fd5
MD5 5cc101c9dc92fde60c498249e5be0d5b
BLAKE2b-256 2f540c4e98176ecd563bb7c72108b4a11790c5617e9e5eccc15ff5726fc36e80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f074bd6b45717e440d2a40f9a7e6d2e7f53b02e334484640f4d7c866c4aa9a10
MD5 f01ed031ad4a88cf9017f2fa70fdcc06
BLAKE2b-256 c5d68056f4e0a855cfba54f1399e971924c803be7bfed9937d8ddec5388ec844

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12a22a688a57793ca4c2e5678aad06bda1419751cffa7c2531874d52bb042178
MD5 5f78a5a5bf61533ce246ac61e5bf2693
BLAKE2b-256 7ce2ee44270710564cfc943bf0556305988539db5387112bd3e02e33349b16b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-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.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f3d4d3b49fabb076757271c6cc37870a7ccaaf71658c43970b6aa0debfbe281a
MD5 888ada57e30fda883b7b123ea32e7ca0
BLAKE2b-256 97ec7c8926bf88b7cbdf06aa8130925ca33b3d139a1b2ea5dd5e481381f74b41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.20-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 754.3 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.20-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 89f6969759d06e152defa98425e9eee263d7547085840873d1a14b5f7fe63ec6
MD5 55c35da69a25b531925ca8f287385f5c
BLAKE2b-256 d976f7c227c7d373ab8282cb94a7e1fb6187a8b209ce6b4931e733c5d10ec267

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