41 lines
1.2 KiB
Markdown
41 lines
1.2 KiB
Markdown
# python-map-manager (local copy)
|
|
|
|
Minimal local copy of the `python-map-manager` package for development and testing.
|
|
|
|
Usage:
|
|
|
|
1. Install dependencies (recommended in a virtualenv):
|
|
|
|
```powershell
|
|
python -m pip install -r requirements.txt
|
|
```
|
|
|
|
2. Run the debug tool:
|
|
|
|
```powershell
|
|
python debug_tool.py
|
|
```
|
|
|
|
This will try to download tiles from OpenStreetMap and show a small stitched image.
|
|
|
|
Progress callback
|
|
-----------------
|
|
|
|
The library supports an optional progress callback that consumer applications
|
|
can provide to receive per-tile progress updates while stitching. The
|
|
callback signature is:
|
|
|
|
```
|
|
progress_callback(done: int, total: int, last_tile_duration: float, from_cache: bool, tile_coords: tuple)
|
|
```
|
|
|
|
- `done`: number of tiles processed so far
|
|
- `total`: total number of tiles to process
|
|
- `last_tile_duration`: seconds spent fetching/reading the last tile
|
|
- `from_cache`: True if the tile was already present in cache before retrieval
|
|
- `tile_coords`: a (z,x,y) tuple identifying the tile
|
|
|
|
The callback may be invoked from the thread that called into `stitch_map_image`,
|
|
so GUI applications should marshal updates onto their UI thread (for example
|
|
using `root.after` in Tkinter).
|