Skip to main content

A Python library for rendering heatmaps to Web Mercator tiles.

Synopsis

This snippet generates PNG tiles for a heatmap where colours indicate data point density:

# standards
from pathlib import Path

# volute
from volute import Config, DataPoint, Gradient, LatLng, LatLngBox, render_heatmap_to_tiles

# Configuration options. The web-based interactive tool in the "configurator"
# subdirectory can be used to iteratively find the best config.
config = Config(
    gradient=Gradient.GREEN_TO_RED,
    num_colors=200,
)

tiles_root = Path("/www/my/tiles")
for zoom in range(12, 16):

    # This will create all the tiles, as a sequence of (int, int, PIL.Image) tuples
    iter_tiles = render_heatmap_to_tiles(
        config,
        LatLngBox(south=55.8516, west=-3.4306, north=56.0059, east=-2.9480),
        zoom,
        [DataPoint(LatLng(lat, lng)) for lat, lng in my_data_points],
    )

    # Then we can save the tiles to disk
    for tile_x, tile_y, tile_image in iter_tiles:
        tile_file = tiles_root / f"{zoom}" / f"{tile_x}" / f"{tile_y}.png"
        tile_file.parent.mkdir(parents=True, exist_ok=True)
        tile_image.save(tile_file)

Examples

See it in action: https://saintamh.org/maps/edinburgh-street-crime/

Metadata

Release files for volute 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for volute 1.0.1
File Size Uploaded Provenance
volute-1.0.1.tar.gz 8.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for volute 1.0.1
File Interpreter ABI Platform
volute-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / volute-1.0.1.tar.gz

Download URL volute-1.0.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
51b4c5290360e3906cc408c81644e0f08fe1fcbb9e019ab35f9f8511f27de7e3
BLAKE2b-256 checksum
How to use checksums
3a0cb85cbdec943c99486b978037f9aac520aa8a8114ceeaa925422768c0447f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / volute-1.0.1-py3-none-any.whl

Download URL volute-1.0.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bfaa42a8c195576474486cbba6c693a30bb18a80a31c98428ea37698a903824
BLAKE2b-256 checksum
How to use checksums
fabf9a67160e324e2d691e9585fc92750a9a960943260bd2f98b0ee0065138b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Security for volute 1.0.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 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