Replies: 8 comments 27 replies
-
Hey, i assume you're using sth similar to mbutil to extract the tiles prior to query them. It might ease and accelerate the process but how do you do if you want to update the initial mbtiles? I believe mbtiles have been created to avoid the need to extract them, but I may be wrong as I'm still learning too. As of today tileserver can serve multiple mbtiles source at once, I believe this is what you're trying to achieve with the .zip structure. I like the idea. Today I'm still looking at other solution since I can't manage to run your project on Android (with capacitor and adapter-node ?) But I'll keep an eye to your Dev and keep me posted if you're trying to achieve a offline mobile app as well, we could mutually help each others |
Beta Was this translation helpful? Give feedback.
-
Yes, essentially, it is a loop over the tiles of a given level. You could write a script around mbutil to do the same. I think I will slightly change the way I am doing it so it can be used on any mbtiles file rather than a full planet file. It will work better also for your use case. Just put your file as planet.mbtiles and extract zip files from it. Depending on your data size, slicing the data into multiple zip files may make it easier for the download.
I don't have yet a full answer to that. I would first need to look at planetiler to see if it can create just tile updates, given the openstreetmap updates. If that is the case, just creating update zip files with the updated tiles should do the job.
mbtiles files indeed can be accessed directly with sqlite3. Unfortunately, sqlite3 requires
I have not had time to make the PWA aspect of the app, as I was occupied with some authentication issues in my app. I currently have a working prototype for the zip file download system. I will work on adding the PWA aspect to it and will load a prototype on cloudflare and publish the source code in a branch of this project. |
Beta Was this translation helpful? Give feedback.
-
@BenOnTrack There is a new branch to the project dev/pwa that is a complete PWA with a zip file of the data for levels 0 to 2, which does not allow to zoom much, but does demonstrate how to achieve the goal of creating an installable Progressive Web App. None of it would have been possible without the help of @userquin who knows quite a lot more than I do about the VitePWA plugin. |
Beta Was this translation helpful? Give feedback.
-
PS: The same branch has a script to extract all the tiles for a given range of levels. I have summarily documented the steps to generate another tile file. If you extract data from a limited area, you might be able to pack more than 2 levels in a reasonably sized zip file. |
Beta Was this translation helpful? Give feedback.
-
I wrote a reply half asleep, and my reply did not really address your questions. So here is an edited version that better answers your questions:
The good news is that I believe it is possible to test if the PWA is installed or not. I will rephrase your bullet point as being an non-installed version. Yes, you could do that, have the non-installed version work from server-based data.
There is no portable file-system accessible by a browser app. One can store data in However, since I wrote that, I also went back to planetiler's page and saw the mention of a different file format called pmtiles. One more thing I need to mention is an underlying technology used in the PWA: the service-worker. I will be investigating this approach. The trouble I see is that if the server is AWS S3 (or cloudlfare without the serverless worker), then the browser must be requesting sub-parts of the pmtiles file. I do not know if workbox, the Google tool used in the service-worker can handle that. |
Beta Was this translation helpful? Give feedback.
-
Going back to the original subject of bundled maps, I have been digging deep into pmtiles. The author of that project (actually several projects), @bdon, and other contributors, have done a fantastic job. Following my deeper diving, it seems that I am going to be doing something that is a lot more involved but that hopefully will be more efficient than my first plan. It means, however, that it will take me some time to complete it. If you read the specs for the V3 file format, if the file is |
Beta Was this translation helpful? Give feedback.
-
I have uploaded a working demo code in the branch Note that there is room for a lot of improvements. For example, the download could be done as a single file download without the I'll leave that as an exercise 😄 |
Beta Was this translation helpful? Give feedback.
-
I also have a question regarding the persistence of indexdb through a browser cache clearance ? |
Beta Was this translation helpful? Give feedback.
-
I have written some code to extract tile files from a
planet.mbtiles
into a directory structurez/y/x.pbf
.The resulting directory can be used to serve files directly instead of obtaining the data from the
planet.mbtiles
database.I also have used a browser-side database to cache the tiles, making it much faster to retrieve them after the initial load and reducing the network traffic. Note that MapLibre allows to set a cache size so that caching is handled directly by the MapLibre library. Doing it on the app side however does give us more control on what to keep and allows this:
The next step could be to serve some zip file of tiles that can be stored in the browser-side database. Such a feature can be very useful in several situations. E.g. for an app that wants to cover just one country or region, the zip file could contain all the tiles just for that region. I believe @BenOnTrack could make use of this?
Beta Was this translation helpful? Give feedback.
All reactions