Add option to store map tiles for offline missions#2085
Add option to store map tiles for offline missions#2085ArturoManzoli merged 3 commits intobluerobotics:masterfrom
Conversation
Signed-off-by: Arturo Manzoli <[email protected]>
rafaellehmkuhl
left a comment
There was a problem hiding this comment.
Everything seems to be working great!
| }) | ||
|
|
||
| const esri = L.tileLayer( | ||
| const esri = tileLayerOffline( |
There was a problem hiding this comment.
Shouldn't we also apply that to the other tiles (osm, seamarks and marineProfile)?
There was a problem hiding this comment.
Sure, I'll check for support and add those
There was a problem hiding this comment.
Shouldn't we also apply that to the other tiles (
osm,seamarksandmarineProfile)?
Done!
b664697 to
f9508f4
Compare
rafaellehmkuhl
left a comment
There was a problem hiding this comment.
Besides the requested code change, I have a question: how can I test it?
I disabled my internet connection on master and re-opened Cockpit, and a section of the map was already there. Doing the same in this branch, the same section is there. It can be seen below:
Kapture.2025-09-17.at.12.27.46.mp4
src/components/widgets/Map.vue
Outdated
| saveCtl.addTo(map.value) | ||
| } | ||
|
|
||
| esri.on('savestart', (e: any) => { |
There was a problem hiding this comment.
From this part of the code I assume the saving events are attached specific to the ESRI tiles, correct? That means, for example, that if the ESRI tiles downloading finish, but the others do not, and the user closes cockpit assuming they are all downloaded, the others will be not, right?
Can we do it in a way that it waits for all of them to be downloaded?
There was a problem hiding this comment.
This library threats all layers in separate. If you want to download a specific one, you should implement a separate logic for that.
I have now implemented the option to download the other layers. Each one will be downloaded at a time.
Signed-off-by: Arturo Manzoli <[email protected]>
Signed-off-by: Arturo Manzoli <[email protected]>
f9508f4 to
a9822a0
Compare
|
On last patch
You can test the feature by making a mission plan while online and then asking to download the tiles on the planning region. |
Ok. I've asked that because there was no clear change in behavior from master to this branch when using the application offline. As the video shows, if I go to around the zoom level that was used during the tiles downloading, it showed the map, but zooming out caused that are to go black. The same behavior happened on both master and this branch. I've tried resetting the Vite server by that time and nothing changed. Did you try using those same steps on master to see if the same tiles do not show up? I'm asking myself if there's some caching involved that is already making tiles to be saved offline. It's strange. Anyway I will try it again on Wednesday (I'm taking the day off tomorrow). If you have any extra instructions before that just let me know. |
Yes, the behavior you're seeing is expected. The tiles are saved starting from the current zoom level, when you press Download, up to the maximum zoom level at that location (the closest zoom). This approach is intentional, as higher zoom levels contain significantly more tiles, and including the outer levels would result in a massive and impractical download. The idea is that the user selects a view that covers their entire work area, and Cockpit will download only the tiles necessary to ensure smooth operation within that region. |
rafaellehmkuhl
left a comment
There was a problem hiding this comment.
Working nicely!
I was able to test it without doubts by adding a session.defaultSession.clearCache() in electron/main.ts, which force-cleaned the browser's cache, making it clear when the offline tiles from the library DB were working.
map_tiles.mp4
Closes #792