hittekaart_py package¶
The hittekaart_py
module provides a Python interface for hittekaart
heatmap generation. Unlike previous modules, this is a binding using
PyO3, and not a subprocess wrapper.
Example¶
from hittekaart_py import (
Track, HeatmapRenderer, Storage, generate
)
tracks = [
Track.from_file(b"Documents/track.gpx", None),
Track.from_coordinates([(45.0, 47.0)]),
]
storage = Storage.Sqlite(b"/tmp/tiles.sqlite")
generate(tracks, HeatmapRenderer(), storage)
Input and output¶
- class hittekaart_py.Track¶
An in-memory representation of a track.
- static from_file(path, compression)¶
Loads a track from the given file.
Renderers¶
- class hittekaart_py.HeatmapRenderer¶
The renderer that generates a heatmap.
- class hittekaart_py.MarktileRenderer¶
The renderer that will only mark visited tiles.
Functions¶
- hittekaart_py.generate(items, renderer, storage)¶
Generates the tiles using the given renderer, and saves them to the given storage.
- Parameters:
renderer (HeatmapRenderer | MarktileRenderer | TilehuntRenderer) – The renderer to use.
storage (Storage) – The storage to output to.
- hittekaart_py.set_threads(threads)¶
Set the number of threads that hittekaart will use.
Note that this is a global function, it will affect all subsequent calls.
Note further that you may only call this function once, at startup. Calls after the thread pool has been initialized (e.g. via a
generate()
orset_threads()
call) will raise an exception.- Parameters:
threads (int) – Number of threads to use.
Errors¶
- exception hittekaart_py.HitteError¶
Catch-all error for underlying hittekaart errors. See the string description for the error cause.