OruxMaps

Uncategorized Boards => MAPAS/MAPS => Topic started by: Hauke on March 25, 2024, 10:04:37 PM

Title: Mapbox format offline maps
Post by: Hauke on March 25, 2024, 10:04:37 PM
Hi OruxMaps team,
I am using OruxMaps GP since ages, loving it!!! Up to today, I use self-made raster maps, but more and more countries start to offer vector maps. Usually in Mapbox format. Since OruxMaps can render Mapbox maps, I was wondering if I can import my own MapBox-Maps as offline maps.
Is there a chance?
Thanks for any hint or pointer!
Best
Hauke
Title: Re: Mapbox format offline maps
Post by: Tronpo on March 26, 2024, 08:37:03 AM
Quote from: Hauke on March 25, 2024, 10:04:37 PM
Hi OruxMaps team,
I am using OruxMaps GP since ages, loving it!!! Up to today, I use self-made raster maps, but more and more countries start to offer vector maps. Usually in Mapbox format. Since OruxMaps can render Mapbox maps, I was wondering if I can import my own MapBox-Maps as offline maps.
Is there a chance?
Thanks for any hint or pointer!
Best
Hauke

Hello, if possible
First you have to have a subscription to featured maps on Oruxmaps.
The offline mapbox maps you're commenting on have a file (style) with the extension.*.json
You have to rename the * file. map.json for Oruxmaps to recognize you
The offline mapbox styles have to be accompanied by the database that generates the map as it can be a vector mbtiles file, you have to place all the files of the same map in a folder
And save the folder in Oruxmaps / mapsfiles.

I would appreciate it if you can tell me where you get these maps, offline I only have the one of my country Spain.
Here's a guide to mapbox in Oruxmaps.

http://tronpoonpo.blogspot.com/2022/10/3d-mapbox_13.html

http://tronpoonpo.blogspot.com/2022/11/3d-mapbox-mapas-personalizados.html

http://tronpoonpo.blogspot.com/2023/05/superposicion-de-capas-mapbox.html


Currently the mapbox maps that come by default allow download for offline use, I haven't had time to make the corresponding guide.


Title: Re: Mapbox format offline maps
Post by: Hauke on March 30, 2024, 07:41:29 PM
Hi Tronpo,

thanks for the pointers and hints! Will look a bit deeper.

The maps I want to use are e.g. these here: https://basemap.de/en/web-vektor/ - they come in Mapbox/JSON format. With QGIS I can download them into an mbtiles format, that works. But from there I'm stuck, but your comments might help.

But do I understand that I can use the Mapbox capabilities of Orux Maps only with a subscription? Not my favourite honestly... It is not that I do not appreciate the Orux Maps team and its efforts - on the contrary, and I've already several times donated and use the payed version of the app, but subscriptions have the problem that they are usually closed, and I cannot e.g. use my own map styles etc...

Happy Easter!
Title: Re: Mapbox format offline maps
Post by: Tronpo on March 31, 2024, 11:33:05 AM
Quote from: Hauke on March 30, 2024, 07:41:29 PM
Hi Tronpo,

thanks for the pointers and hints! Will look a bit deeper.

The maps I want to use are e.g. these here: https://basemap.de/en/web-vektor/ - they come in Mapbox/JSON format. With QGIS I can download them into an mbtiles format, that works. But from there I'm stuck, but your comments might help.

But do I understand that I can use the Mapbox capabilities of Orux Maps only with a subscription? Not my favourite honestly... It is not that I do not appreciate the Orux Maps team and its efforts - on the contrary, and I've already several times donated and use the payed version of the app, but subscriptions have the problem that they are usually closed, and I cannot e.g. use my own map styles etc...

Happy Easter!

The subscription gives you access to the "technology" of mapbox, then it offers you some maps by default Mapbox, Google high definition, but it allows you to incorporate your own maps, I use them
For example, from the website you sent me, look how easy it is
https://youtube.com/shorts/zXdMUbthzoU?si=HwF-M_H2P2vtSuFu
With the same browser you download the style, with the file manager you rename it and move it to orux
https://youtu.be/u8kQK3j60u8?si=q8XFRpRVUv5h6FS-
And now you can use it in Oruxmaps GP.
It's a flat style but you can implement 3D...
I'll explain it to you in the next one so you don't get overwhelmed with so much information

I'll leave you with the basic style, with the 3D implemented



Pd:The styles I've seen are all online on the web
Title: Re: Mapbox format offline maps
Post by: Tronpo on March 31, 2024, 03:59:58 PM
Quote from: Tronpo on March 31, 2024, 11:33:05 AM
The subscription gives you access to the "technology" of mapbox, then it offers you some maps by default Mapbox, Google high definition, but it allows you to incorporate your own maps, I use them
For example, from the website you sent me, look how easy it is
https://youtube.com/shorts/zXdMUbthzoU?si=HwF-M_H2P2vtSuFu
With the same browser you download the style, with the file manager you rename it and move it to orux
https://youtu.be/u8kQK3j60u8?si=q8XFRpRVUv5h6FS-
And now you can use it in Oruxmaps GP.
It's a flat style but you can implement 3D...
I'll explain it to you in the next one so you don't get overwhelmed with so much information

I'll leave you with the basic style, with the 3D implemented



Pd:The styles I've seen are all online on the web
The topographic map looks much better thanks to the shading and contour lines.
Thanks for the support of the website, there are very interesting things
Title: Re: Mapbox format offline maps
Post by: Hauke on April 01, 2024, 01:38:28 PM
Thanks Tronpo, very helpful! I looked at the subscription prices, and they are reasonable. If it even helps to support Orux Maps further development, I'll be happy to subscribe! And if I am able to include my own maps, my goal is achieved - and you just have proven that it is possible - thanks for providing the necessary files!

Btw. - this one follows the same scheme: https://basemap.at/en/bmapv/

Both basmap.de and .at are excellent maps, issued by the government and of outstanding quality.
Title: Re: Mapbox format offline maps
Post by: Hauke on April 01, 2024, 02:40:35 PM
Thanks again for your help, it works nice and easy!

Except for using the Mapbox maps in 2D - here I hit a problem: I cannot zoom in at some point! If I start with a raster map at zoom level e.g. 16, and then load the Mapbox vector map, it displays nice and detailed at zoom level 16. Now if I zoom out, e.g. to level 9, I cannot zoom in anymore beyod level 11, or, with another map, level 10 - it is not even the same for different maps. I looked into the JSON if there is any minzoom/maxzoom restriction coded, but that does not seem to be the case. If I use a Mapsforge vector map, I can zoom as much as I like, the problem is not there.

And a question: Can I combine two different vector maps? My goal is to overlay the basemap.de with OpenStreetMap POIs.

...OK, and next I'll try offline vector maps :-)
Title: Re: Mapbox format offline maps
Post by: Tronpo on April 01, 2024, 04:50:56 PM
Quote from: Hauke on April 01, 2024, 02:40:35 PM
Thanks again for your help, it works nice and easy!

Except for using the Mapbox maps in 2D - here I hit a problem: I cannot zoom in at some point! If I start with a raster map at zoom level e.g. 16, and then load the Mapbox vector map, it displays nice and detailed at zoom level 16. Now if I zoom out, e.g. to level 9, I cannot zoom in anymore beyod level 11, or, with another map, level 10 - it is not even the same for different maps. I looked into the JSON if there is any minzoom/maxzoom restriction coded, but that does not seem to be the case. If I use a Mapsforge vector map, I can zoom as much as I like, the problem is not there.

And a question: Can I combine two different vector maps? My goal is to overlay the basemap.de with OpenStreetMap POIs.

...OK, and next I'll try offline vector maps :-)

Strange... I don't have a problem with zooming, try clearing the vector memory, both in orux and Android.
JSONs can overwhelm this memory

There are two very good map editors that are
Mapbox studio and Maptiler cloud have a wide variety of (updated) basemaps, so you can customize as you want, upload files to create your own layers.
Then you can take the json style to Oruxmaps...
You can also use a text editor and compose the maps by copying and pasting saurces and layers (there is no documentation of this, I learned by trial and error) there is an editor called maputnik, you can also take a look at it.
The world of json is amazing.
Little by little. Throw your doubts here and I will try to help you as much as possible. Within my knowledge
Title: Re: Mapbox format offline maps
Post by: Tronpo on April 01, 2024, 04:56:17 PM
Quote from: Tronpo on April 01, 2024, 04:50:56 PM
Strange... I don't have a problem with zooming, try clearing the vector memory, both in orux and Android.
JSONs can overwhelm this memory

There are two very good map editors that are
Mapbox studio and Maptiler cloud have a wide variety of (updated) basemaps, so you can customize as you want, upload files to create your own layers.
Then you can take the json style to Oruxmaps...
You can also use a text editor and compose the maps by copying and pasting saurces and layers (there is no documentation of this, I learned by trial and error) there is an editor called maputnik, you can also take a look at it.
The world of json is amazing.
Little by little. Throw your doubts here and I will try to help you as much as possible. Within my knowledge

With this guide and the second part, you can get the idea of copying and pasting the code.
You can also see the terrain mapbox layer that is needed to give the 3D effect to the json
https://tronpoonpo.blogspot.com/search?q=Json

http://tronpoonpo.blogspot.com/2023/06/rasterjson-2.html
Title: Re: Mapbox format offline maps
Post by: Hauke on April 01, 2024, 05:20:36 PM
Quote from: Tronpo on April 01, 2024, 04:50:56 PM
Strange... I don't have a problem with zooming, try clearing the vector memory, both in orux and Android.
JSONs can overwhelm this memory

No success with that - cleared all caches I could find in Orux Maps, and cleared the cache in Android (of the Orux Maps App). I am reluctant to clear the Android-Storage of Orux maps - won't that contain all my settings? I do not want to lose them...

The funny thing is, when I switch to a raster map, zoom in, then switch to the vector map, it loads without problem...
Title: Re: Mapbox format offline maps
Post by: Hauke on April 01, 2024, 08:37:35 PM
Quote from: Tronpo on March 26, 2024, 08:37:03 AM
The offline mapbox maps you're commenting on have a file (style) with the extension.*.json
You have to rename the * file. map.json for Oruxmaps to recognize you
The offline mapbox styles have to be accompanied by the database that generates the map as it can be a vector mbtiles file, you have to place all the files of the same map in a folder
And save the folder in Oruxmaps / mapsfiles.

This does not seem to work for me. I used QGIS to download the vector files into a .mbtiles file (and verified that it contains the vector data), named it testvector.mbtiles. Then I saved the style definition and saved it into testvector.map.json. Put both into orux maps mapfiles folder, in a new folder named testvector. I can now pick "testvector" from the map sources (under Online maps/Mapbox JSON), but if I am in flight mode (really offline), it does not load the map. I looked into the style JSON, and changed the data URL from the online URL to file://storage[...]/testvector.mbtiles (i.e. to the internal file path of the mbtiles file), but that did not yield results.

Do you perchance have more guidance on the required file formats? I downloaded an offline copy of a mapbox leisure map, but the mobile phone's file system seems to hide the resulting files from me, so I cannot "reverse engineer"...

Any guidance highly appreciated!

Btw. Regarding the zoom bug, I've more "insights": When I load a Mapbox map in 2D view, it loads in the current zoom factor. If I zoom out, I can only zoom in again to the level I last had, so if e.g. I started at 16, zoom out to 14, I'm stuck at 14 max. If I then zoom out to e.g. 10, I am stuck at 10 and cannot go anymore to 14. And so on, until I reach the minimum of 4.
Title: Re: Mapbox format offline maps
Post by: Tronpo on April 02, 2024, 07:15:23 AM
Quote from: Hauke on April 01, 2024, 08:37:35 PM
This does not seem to work for me. I used QGIS to download the vector files into a .mbtiles file (and verified that it contains the vector data), named it testvector.mbtiles. Then I saved the style definition and saved it into testvector.map.json. Put both into orux maps mapfiles folder, in a new folder named testvector. I can now pick "testvector" from the map sources (under Online maps/Mapbox JSON), but if I am in flight mode (really offline), it does not load the map. I looked into the style JSON, and changed the data URL from the online URL to file://storage[...]/testvector.mbtiles (i.e. to the internal file path of the mbtiles file), but that did not yield results.

Do you perchance have more guidance on the required file formats? I downloaded an offline copy of a mapbox leisure map, but the mobile phone's file system seems to hide the resulting files from me, so I cannot "reverse engineer"...

Any guidance highly appreciated!

Btw. Regarding the zoom bug, I've more "insights": When I load a Mapbox map in 2D view, it loads in the current zoom factor. If I zoom out, I can only zoom in again to the level I last had, so if e.g. I started at 16, zoom out to 14, I'm stuck at 14 max. If I then zoom out to e.g. 10, I am stuck at 10 and cannot go anymore to 14. And so on, until I reach the minimum of 4.

Here's how little I know about mapbox offline
In the case of the cartography of my country, the "map" is composed of 4 files:
- "Fonts" (letters) and "Sprites" (Icons))
-Estilo.json
-terrain elevation "terrain25.vm.mbtiles"
-The base of the map "vtiles_cnig.vm.mbtiles"

The style URLs are addressed as "local" to these files
I'll give you the style so you can see how the code is structured.
Title: Re: Mapbox format offline maps
Post by: Hauke on April 02, 2024, 07:12:03 PM
Quote from: Tronpo on April 02, 2024, 07:15:23 AM
The style URLs are addressed as "local" to these files
I'll give you the style so you can see how the code is structured.

Oh, that would be awsome! If you don't mind (and if the map accessrights allow) I'd even appreciate if you could send over the complete offline map - that would be just perfect! But I'll go for the style file as a starting point :-)

Thank you very much for your patience and support here!
Title: Re: Mapbox format offline maps
Post by: Tronpo on April 03, 2024, 08:09:13 AM
Quote from: Hauke on April 02, 2024, 07:12:03 PM
Oh, that would be awsome! If you don't mind (and if the map accessrights allow) I'd even appreciate if you could send over the complete offline map - that would be just perfect! But I'll go for the style file as a starting point :-)

Thank you very much for your patience and support here!

The files are very heavy, I have sent you an email with links and instructions
This is me

siguiendotrack@gmail.com
Title: Re: Mapbox format offline maps
Post by: Hauke on April 03, 2024, 08:32:29 PM
Just now downloading, thanks a lot! Not sure when I'll have time to check them, next days are busy, but I'll report back!

EDIT: Put it on my phone, and it works. A look into the files is very informative, that helps a lot!
Title: Re: Mapbox format offline maps
Post by: Hauke on April 07, 2024, 07:51:13 PM
Huge step forward: Was able to create my own Offline map successfully! Lots of manual work, and still need to investigate some details to get it nice, but the "Proof of concept" is done and works! I'll write up a full guide at a later point, when I worked all out.
Thanks again Tronpo, your example offline map was very valuable for this!
Title: Re: Mapbox format offline maps
Post by: Tronpo on April 08, 2024, 06:10:26 AM
I'm glad you accomplished!! Looking forward to seeing your progress
Title: Re: Mapbox format offline maps
Post by: Hauke on May 06, 2024, 10:48:19 PM
Quick Update: I've now all things in place - a detailed write-up will follow, but I may need a few weeks time for that, other projects looming. So here's what I currently achieved:

An offline atlas that contains:
Using QGis I downloaded the basemap data into two mbtiles DBs (map data + contour lines), and added my OSM mbtiles.

I created this for the German states Northrhine-Westfalia and Rhineland-Palatinate, which add up to about 50.000 kmĀ² --> This just eats up 650 MB! That is just amazing!

I really like that I even can edit the style of basemap - I guess to save rendering resources I might disable objects in the map that are of no interest for me.

This is very new, so I need to gather a bit of real world experience with it - one thing I can observe: If I use this offline atlas, adding also Orux Maps hillshading, my phone's battery eats away rather quickly... I hope that this is just because I played around so much just now, enjoying my product... To be on the safe side, I'll bring a powerbank for the next hiking tour :-)

Also, when browsing around a lot in the map, at some point something breaks and the rendering of new areas is incomplete. Loading another map and switching back to mine fixes it. I guess it's a bit too much for the limited resources of my phone...
Title: Re: Mapbox format offline maps
Post by: Tronpo on May 07, 2024, 10:31:09 AM
Hello, you already have the first follower of your thread about these maps.
Congratulations and thank you for sharing your knowledge