Mapbox offline maps: Webserver dies when Oruxmaps is put into the background

Started by Hauke, May 14, 2024, 01:08:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hauke

When I open a Mapbox format offline vector map (2D view) and move around, it works just fine - can scroll zoom - anywhere, no issues. If I then send Oruxmaps into the background and then pull it up again, all previously rendered areas are still there, and I can zoom, scroll etc. as before, but as soon as I move outside of the previously rendered parts (both in area as well as in zoom level), the map does not update and I usually only see the coarse renderings of the low zoom levels.

If I load another map (any kind) and then re-load the faulty map, it works again - until I put oruxmaps into background.

My assumption is, that the local webserver that serves the vector tiles dies (I mean the server listening on http://localhost:8998/). I have Oruxmaps configured so that it is exempt from power saving of Android, so I assume that it is not connected to that.

Attached is a screenshot with crashed situation.

Hauke

I've more evidence that the tile-server dies. I've now integrated some raster map via mbtiles into my mapbox offline map (and that is SO! COOL! that this is possible! It expands the possibilities for offline maps so much! Thanks for implementing this feature!). If I send Oruxmaps into background and pull it up again, no new tiles are served - see attached "Broken.jpg". If I restart Oruxmaps (or switch maps back and forth), all is working again - see attached "OK.jpg".

Any chance this gets fixed? My gut feeling is that this should be an easy fix - but I may be totally wrong here...

Hauke

...and some more evidence: I created a mixed mapsource, combining offline (local mbtiles) plus online (Web-URLs with pbf tile services). When I put Oruxmaps into the background, the offline-tiles "die", i.e. they miss in the rendering. The online sources continue to work. So the renderer obviously works, but data delivery through the local web server is not successful.

Since I had no reaction to this bug yet: What is the best way forward? How can I best provide input? How do I know if this bug caught the awareness of the developers? Don't get me wrong: I do not want to put pressure or so, I just would love to hear feedback. It takes as long as it takes of course!

Tronpo

Quote from: Hauke on May 21, 2024, 02:29:16 PM...and some more evidence: I created a mixed mapsource, combining offline (local mbtiles) plus online (Web-URLs with pbf tile services). When I put Oruxmaps into the background, the offline-tiles "die", i.e. they miss in the rendering. The online sources continue to work. So the renderer obviously works, but data delivery through the local web server is not successful.

Since I had no reaction to this bug yet: What is the best way forward? How can I best provide input? How do I know if this bug caught the awareness of the developers? Don't get me wrong: I do not want to put pressure or so, I just would love to hear feedback. It takes as long as it takes of course!
Hello, maybe the problem is not Oruxmaps or yours, I explained some time ago I was looking for information on how to create my offline mapbox, in the documentation I found
https://docs.mapbox.com/help/troubleshooting/mobile-offline/

The mapbox SDK offers the direct download of tiles from your online maps, to work in cache.
This is offered directly by Oruxmaps Gp
What I'm saying is that I think the mapbox sdk isn't developed to use the "homemade" maps you're developing.
At least the most modern versions of the mapbox sdk.
The Spain maps app uses an older sdk than Oruxmaps Gp, this version of the sdk does not have a 3D viewer but the offline maps of the IGN work better (not perfectly) with this sdk, than with the Oruxmaps Gp sdk
The potential of the mapbox sdk is in the online maps today, and in making it easier to download to use As a cac memory
Strava, fatmap, uses the same sdk as Oruxmaps Gp offering the
But in Oruxmaps we are offered the possibility to use our maps.


I add: try using lighter weight maps.
About the developers of Oruxmaps........ It's only one, surprising isn't it?




Hauke

Thanks for the explanation!

Indeed, the documentation saying "The cumulative amount of unique maps tile packs used in the offline regions cannot be greater than 750" hints on some potential problem here. And that's quite a bummer honestly. perhaps switching to Maplibre SDK might be a way forward?

That said, I seem to have indications that this is not my problem. I'll try to explain why:

The offline maps I create use as data source in the style "http://localhost:8998/MySelfmade.mbtiles/{z}/{x}/{y}.pbf" - which makes me assume that Oruxmaps starts a simple webserver that serves the content of the mbtiles DB. There are several lightweight servers out in the wild, and I personally for style creation serve my mbtiles via tilemaker-server. So from the viewpoint of Mapbox GL, it is effectively an online source, which happens to be served locally.

What I think supports my theory is the fact that my map very likely exceeds the 750 tile packs (I mean: whole Germany?), but it works just nicely and without any issues as long as I keep Oruxmaps in the foreground. I can move east, west, north, south, in and out as much as I like, and it just works. I've as a stresstest (and to enjoy my product :-) ) been browsing my map for several minutes, looking at various regions all over Germany. It just worked to my utter delight. But as soon as I send Oruxmaps in the background, and regardless if I did just load the map or did excessive map browsing before, reproducibly after that the map gets stuck. all that was rendered before is there, cached, but any region that needs new rendering fails.

To further verify my statement, I will perhaps prepare a lightweight, very small map and see if I can reproduce the problem even with that.

Writing this, it comes to my mind to look for an "external" mbtiles-server as Andoid app... If such a thing exists, I might have my workaround, even bypassing the mapbox limit...

Thanks again for discussing with me! And Kudos to Jose Vazquez for keeping Oruxmaps alive as a one man show! Impressive!

EDIT: Just found this: https://github.com/bojko108/mobile-tile-server - available in Google Play: https://play.google.com/store/apps/details?id=com.bojko108.mobiletileserver&hl=de&gl=US --> Will try this! My hopes are high!

EDIT EDIT: Not compatible with Android 13 - nooooooo!

Hauke


Hauke

It's me again - sorry for being a PITA :-)

The author of Mobile Tile Server was so nice to recompile his mbtiles android server for Android 13, and I got it up and running. It cannot serve vector tiles correctly, but since the error I describe also affects raster tiles, I used the exact same raster mbtiles file to once use it with OruxMaps builtin localhost:8998 server, and once via Mobile Tile Server (localhost:1886) with otherwise the same style JSON data.

With the OruxMaps builtin server, after sending OruxMaps once to the background, tile delivery stops and previously uncached regions stay empty. With the Mobile Tile Server, this is not the case. I can send OruxMaps to the background as often as I want, tile delivery is working and new areas are rendered as needed.

Thanks for fixing this at some point!

Hauke

...and this will be my last post on this topic for the time being, workaround established:

The Author of Mobile Tile Server, Bogdan Hristozov, was so friendly to work again on his software and fix the issue with the vector tiles - 1000 thanks to him! Now I can use the vector mbtiles in OruxMaps via the Mobile Tile Server, and I can confirm, that this is stable even when sending OruxMaps in the background. That, for the time being, solves my problem, at the price to take care that the server is running when I am using Oruxmaps, but I guess I can now wait very well for this bug being fixed in OruxMaps.

For others that suffer from the same issue as me, i.e. want to use Mapbox format offline maps in mbtiles and have them stuck after putting OruxMaps into the background: Install Mobile Tile Server, configure it to serve your mbtiles files, and change the URL in the .map.json to http://localhost:1886/mbtiles/YOUR.mbtiles/{z}/{x}/{y}

Tronpo

Hello, can you explain a little more about the process?
Where do I place my mbtiles file ? In orux or in the Mobile tiles server app
Then I keep the app on and go to orux to view the json?
Best regards

Hauke

Sure, here are the steps:

1. Install Mobile Tile Server - as of this writing you'll need to take the APK from the Github page - as soon as the new release has passed the Google checks, it should be available via Google Play.
2. If you have your mbtiles files in the OruxMaps offline maps directory, and there in a subdirectory (that's how I do it), you'll need to rename the subdirectory to "mbtiles". Mobile Tile Server expects all mbtiles files it can serve in a directory named mbtiles. If you do not want to change your OruxMaps directory, you'll need to create a separate directory and copy the mbtiles files there.
3. Configure Mobile Tile Server to serve data from the OruxMaps mapfiles directory, or, alternatively, from the directory you created. So if your directory containing the mbtiles files is named /storage/myfiles/mbtiles/, you need to configure Mobile Tile Server's root directory as /storage/myfiles/. For this, navigate to the settings of Mobile Tile Server and tap on "Tiles root directory path". Unfortunately there is no directory browser, you need to type the path – so as a preparation make sure you have this path at hand, e.g. by looking into the OruxMaps configuration.
4. Configure background activity of Mobile Tiles Server: To make sure that the Mobile Tile Server runs in the background and keeps running, you need to adjust the Android power settings of the App to "Unrestricted".
5. Change the <YourMap>.map.json files to use Mobile Tile Server. The URL for mbtiles access of the Mobile Server is http://localhost:1886/mbtiles/YourMap.mbtiles/{z}/{x}/{y} – so your .map.json-files need all URLs that currently are http://localhost:8998/YourMap.mbtiles/{z}/{x}/{y}.pbf changed to http://localhost:1886/mbtiles/YourMap.mbtiles/{z}/{x}/{y}

Now, before loading the map in OruxMaps, be sure that you started the Mobile Tile Server app and that you clicked on "Start" in it.

Tronpo