Skip to main content

lltiler

The Lat-Lon Tiler is a small tool to create map tiles in spherical Mercator projection for the use with online map libraries like Leaflet, OpenLayers, Mapbox etc...

usage

In order to create tiles with lltiler, the user must provide a function which can compute colors for given pairs of latitude and longitude. A typical example would be a function which interpolates an image onto the given latitudes and longitudes. This method is used to generate the most detailed level of tiles in a first step. In an optional second step, multiple tile sets generated using LLTiler can be combined using the overlay_tiles utility. In the last step, coarsened tiles are generated in successive steps from the most detailed level up to global scale using the pyramid_step utility. The second and third step can be executed automatically using the generate_tile_makefile utility and GNU make.

1 generate detailed tiles

A user supplied function and a lat/lon bounding box must then be handed to the render method of the LLTiler object, which will then compute the necessary tiles and calls the given function repeatedly until all tiles have been generated. An example is shown below:

from lltiler import LLTiler
import matplotlib.pylab as plt
import matplotlib.colorbar

lat_min = 16.
lon_min = 45.
lat_max = 19.
lon_max = 48.

cmap = plt.get_cmap("gray")

def f(lat, lon):
    rel_lat = (lat - lat_min) / (lat_max - lat_min)
    rel_lon = (lon - lon_min) / (lon_max - lon_min)
    valid = (rel_lat >= 0) & (rel_lat < 1) & (rel_lon >= 0) & (rel_lon < 1)
    colors = cmap(rel_lat, bytes=True)
    colors[..., -1] = 255 * valid
    return colors

t = LLTiler("temp_maps/gray", size_hint=1000.)
t.render(((lat_min, lon_min), (lat_max, lon_max)), f, show_progress=True)

Note that show_progress=True additionally requires the tqdm package.

2 (optional) combine multiple overlapping tiles

If multiple tilesets have been generated using the first step and these tilesets should be combined to one tileset, the overlay_tiles utility can be used to paint multiple images on top of each other. This is of course only useful if the image which is painted on top contains transparent regions where parts of the lower image can be seen through.

overlay_tiles <output_image> <input_image_1> <input_image_2> ... <input_image_n>

3 generate image pyramid

To generate coarser resolution images from detailed images, the pyramid_step utility can be used. It takes up to four adjacent images (missing images are assumed to be entirely transparent) stacks these images together and generates a new image with half of the original resolution.

pyramid_step <output_image> <top_left> <bottom_left> <top_right> <bottom_right>

Missing images must be denoted by a -.

automate steps 2 and 3

The generate_tile_makefile utility can be used to automate steps 2 and 3:

generate_tile_makefile <base_level> <input_folder> <output_folder> | make -f- -j

base_level must be the tile-level for which the tiles have been generated in step 1. input_folder must be a folder which includes one folder per input tileset. output_folder is the folder into which the resulting tiles should be written.

Note that in the above command generates a makefile which is directly passed to make and then executed in parallel.

Metadata

Release files for lltiler 0.0.2

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

Source distribution (sdist)

Source distribution for lltiler 0.0.2
File Size Uploaded Provenance Actions
lltiler-0.0.2.tar.gz 24.4 kB Without provenance Details for lltiler-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 32.8 kB

Release files / lltiler-0.0.2.tar.gz

Download URL lltiler-0.0.2.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2e0148cf29a41ee5c2cd72339a07b68c0712d5087dd29138c30f1a3b4a4ad518
BLAKE2b-256 checksum
How to use checksums
94abce03ecab06314cef2600b680261fd7caa3aa14aa8a3488b105ea1add9b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release files / lltiler-0.0.2-py3-none-any.whl

Download URL lltiler-0.0.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a75c57dac084cd5d852e57d28518d0d3ce88abaf9be891a7e6bb2388a6ec650e
BLAKE2b-256 checksum
How to use checksums
5dea7b427646befb2c768540b92017d731c61742f0b6b970eb25ba1d37c524a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Security for lltiler 0.0.2

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

0.0.2 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