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.18.tar.gz (223.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.18-cp314-cp314-manylinux_2_31_x86_64.whl (718.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

maplibre_tiles-0.1.18-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.18-cp310-cp310-manylinux_2_31_x86_64.whl (723.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18.tar.gz
  • Upload date:
  • Size: 223.5 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.18.tar.gz
Algorithm Hash digest
SHA256 205886a7159e401540ef4893cf4fd984bb0b2a2bd7031f4ce34cfe84d60d9c18
MD5 3b82278d8ecd92fe00a15b979daf5ea2
BLAKE2b-256 03e70a3f83c71f4eeb853037acac24b679db10a46e2c18c9b9272dd5d0caee57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 718.8 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.18-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 798e01d1d366f001a35b600db2c0353e0bf331c6adaaa654775d832619f7b667
MD5 a1640b056f906bdbf62f53e4a0b9abab
BLAKE2b-256 17d2509cf91e0d0c0441185782e19adf50f19144b51e3d2c9fd3dba9491f1156

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aebb01a3d2e5a34b8db06a013463511d05f8d6d8723fa090132d994fb04eb3ed
MD5 8a24178303a6fde3411d384fe4b33f5c
BLAKE2b-256 4239034541cde14d757498eb969d2fd78050cbe205ced229470fb593b6fa099b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8b4531b93cc157a2762b51f64a9a01af96a8015ca09aa02b86f86412f8bcc50a
MD5 0e4520785f0a4a117da04948f016d5fc
BLAKE2b-256 9f9d3844062dfdf455a626bcfdd16c410b53311641d3d12b03470769812c4752

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59595f1363fd3ba846201e0822c95706423f2b5164971fc3649a94c6776500d6
MD5 ef33d2d62315f1dee1ab690703aaa812
BLAKE2b-256 6e3afde696c1d16fd3e15594580e8be502ee2b559e4a92df6b00f54fb396a9bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4edb98ed729812ef16ec8a55ffbaee7800876d874934677bca48241dc6798df5
MD5 16744dd2f4c2786493f8e9f2fa98d06d
BLAKE2b-256 c8d18b4d4f6b5a6d46716aba7a631902785db1b2a9cf6026788c1d0805156b73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42b03fd969e78807bf26559d8d8f5c924d14af73efb3af6055a5aabd450c26bd
MD5 177108c123a27c2cd7d5ff9ce34e1b97
BLAKE2b-256 f48ec9b460267aab4c10c2f862d68632e4265e82a98447b5043a4bad39689b95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4a348a21a3b2827c429ca344a0b539dc9f4e35c1747ef7cc7b9eee3832cdf19f
MD5 de63e41466dc65116d7196737202269b
BLAKE2b-256 84055acbe2bc472c2f645450b523457fa83c77d1ec35ba2b706b90a86c74cdb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 327f98256e6342f45cf3236d407e06f797cfc535d3b2551586b8564e973ea260
MD5 278adb3fe4cd7f568efdbf34fd59e1a8
BLAKE2b-256 93b7a46fb736ea911d1f3344cfd8ad395340f29c6b551c48c80faca2503bd74b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-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.18-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1864ebf0fbc8076418d5b08c941e457b62d8992797307826b59ed97d5f9792b6
MD5 eb653925157c12956a1e3340627d37c6
BLAKE2b-256 20e7e09b1c6c734e6d4bbedfd6afa8ef59b88b5510890d1da2ac82b320daee4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maplibre_tiles-0.1.18-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 723.0 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.18-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 1572989e1a288efe60f1dd78ee030968c5a203d13d844ce3d3bd91cf89a9326b
MD5 817ed87783396c2ccdf07dfd366f94d9
BLAKE2b-256 3b194e3aa52905553e4686618608bdad941f862869c2fc5afaa5e443b4c0f194

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