-
Notifications
You must be signed in to change notification settings - Fork 4
Add offline map tile prefetch tooling #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
1dbfbcc
3e336a4
d26d110
d1a15d5
29d1416
e1e6259
4d62063
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| +10 −2 | src/LXMF/LXMRouter.cpp | |
| +12 −8 | src/LXMF/LXMessage.cpp |
| 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) | ||
| 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 |
| 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`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ( Prompt To Fix With AIThis 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.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||

There was a problem hiding this comment.
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.logandprefetch_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*.logor these specific filenames to.gitignore.Prompt To Fix With AI
There was a problem hiding this comment.
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