Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.pio/
.vscode/
*.pyc
/tiles/
docs/flasher/firmware/
lib/tdeck_ui/Hardware/TDeck/SplashImage.h
deps/microReticulum
2 changes: 1 addition & 1 deletion deps/microReticulum
16 changes: 16 additions & 0 deletions prefetch_map_tiles.stderr.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FAIL https://tile.openstreetmap.org/13/2552/2984.png -> tiles\13\2552\2984.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2985.png -> tiles\13\2552\2985.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2986.png -> tiles\13\2552\2986.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2987.png -> tiles\13\2552\2987.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2988.png -> tiles\13\2552\2988.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2989.png -> tiles\13\2552\2989.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2990.png -> tiles\13\2552\2990.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2552/2991.png -> tiles\13\2552\2991.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2984.png -> tiles\13\2553\2984.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2985.png -> tiles\13\2553\2985.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2986.png -> tiles\13\2553\2986.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2987.png -> tiles\13\2553\2987.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2988.png -> tiles\13\2553\2988.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2989.png -> tiles\13\2553\2989.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2990.png -> tiles\13\2553\2990.png (HTTP Error 404: Not Found)
FAIL https://tile.openstreetmap.org/13/2553/2991.png -> tiles\13\2553\2991.png (HTTP Error 404: Not Found)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log files should not be committed

These log files (prefetch_map_tiles.stderr.log and prefetch_map_tiles.stdout.log) are runtime output artifacts from a test run and should not be tracked in the repository. Consider removing them from the commit and adding *.log or these specific filenames to .gitignore.

Prompt To Fix With AI
This is a comment left during a code review.
Path: prefetch_map_tiles.stderr.log
Line: 1-16

Comment:
**Log files should not be committed**

These log files (`prefetch_map_tiles.stderr.log` and `prefetch_map_tiles.stdout.log`) are runtime output artifacts from a test run and should not be tracked in the repository. Consider removing them from the commit and adding `*.log` or these specific filenames to `.gitignore`.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brothercorvo please remove the log files from your PR

14 changes: 14 additions & 0 deletions prefetch_map_tiles.stdout.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Center: lat=43.978093, lon=-66.143359, radius=200.0 km
Zooms: 8..14
Output: tiles
z8: 16 tiles
z9: 55 tiles
z10: 188 tiles
z11: 692 tiles
z12: 2655 tiles
z13: 10393 tiles
z14: 41133 tiles
Total tiles: 55132
Downloaded: 55116
Skipped: 0
Failed: 16
54 changes: 54 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Map tile prefetch script

`prefetch_map_tiles.py` downloads raster XYZ map tiles in the same layout Pyxis expects on the SD card:

```text
tiles/{z}/{x}/{y}.png
```

## How it works

- Uses a center point and radius in kilometers.
- Computes all map tiles that intersect that area for the selected zoom range.
- Downloads each tile as a PNG.
- Saves the files into the Pyxis-compatible `tiles/` folder structure.

The default center point comes from the coordinates shown in the provided screenshot:

- latitude: `43.978093`
- longitude: `-66.143359`
- radius: `200 km`

## Basic usage

Dry run:

```bash
python tools/prefetch_map_tiles.py --dry-run
```

Download tiles:

```bash
python tools/prefetch_map_tiles.py --min-zoom 8 --max-zoom 14
```

Custom area:

```bash
python tools/prefetch_map_tiles.py --lat 44.0 --lon -66.1 --radius-km 100 --min-zoom 10 --max-zoom 15
```

## Copy to SD card

After the download finishes, copy the generated `tiles/` directory to the SD card root so Pyxis can load files like:

```text
S:tiles/14/4823/6160.png
```

## Notes

- Existing files are skipped unless `--overwrite` is used.
- The script defaults to the same OpenStreetMap tile URL currently used by the firmware.
- If you use a different tile provider, pass `--url-template`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing OSM tile usage policy warning

The README should note that the default tile server (tile.openstreetmap.org) prohibits bulk downloading and offline prefetching per the OSM Tile Usage Policy. Users should be directed to use a self-hosted tile server or a provider that explicitly permits offline/bulk downloads.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tools/README.md
Line: 53-54

Comment:
**Missing OSM tile usage policy warning**

The README should note that the default tile server (`tile.openstreetmap.org`) prohibits bulk downloading and offline prefetching per the [OSM Tile Usage Policy](https://operations.osmfoundation.org/policies/tiles/). Users should be directed to use a self-hosted tile server or a provider that explicitly permits offline/bulk downloads.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brothercorvo Greptile is right, here is a screenshot from the usage policy. This is against the OSM Tile Usage Policy linked above

Image

Loading
Loading