NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hey guys...

I want to develop a full offline app, where the map data is included in the apk, for android (java). First I started using the mapbox sdk but unfortunately I noticed that they have a tile limitation of 6k Tiles and I couldn't figure out how to load OpenStreetMap data...

Now I used the osmand sdk to make the map show up with the markers and stuff... I didn't find a clear solution for my problem:

Say I have downloaded the data from https://openmaptiles.com/downloads/planet/ in .mbtiles how can I load the data from the asset folder to my device and show the map, so that someone can install the .apk and will have a full offline Map.

Or is there any "how to" tutorial for building a full offline map-app...

I also checked mapsforge but how I figured out, they focus more on rendering than on pre-loaded data or do I miss something there?

SO: 1. Tutorial to include .mbtiles or 2. Any Tutorial / tips to build full offline map...

Thanks a lot.

asked 09 Mar '19, 15:42

mathmike's gravatar image

mathmike
31113
accept rate: 0%

edited 09 Mar '19, 21:09

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701


The correct answer really depends on what functionality you want to provide (which in turn tends to impact the offline data format).

For simply providing an offline map, mapsforge is a tried solution.

For completeness sake, https://wiki.openstreetmap.org/wiki/Frameworks#Displaying_interactive_maps is a list of relevant frameworks.

permanent link

answered 09 Mar '19, 19:50

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 09 Mar '19, 21:08

Ok, so I definitely will work on mapsforge in that case.

Right now the needed functions are: -providing offlinemap -adding markers and user location (and some marker.OnClickListener) -reverse geocoding -would be nice to provide a full street directory

Is this possible with mapsforge?

(09 Mar '19, 20:41) mathmike

I wrote about this very problem last year. You can read about the whole solution here

https://medium.com/@ty2/how-to-display-offline-maps-using-maplibre-mapbox-39ad0f3c7543

and the code for the same is here

https://github.com/kuwapa/OfflineMapExample/tree/83c7e81391a5f0946ab1fcb3155966c4997d44d3

Essentially, solution is

  1. Use MapLibre SDK
  2. Generate MBTILES using tilemaker or downloaded tiles from Maptiler (the important thing here is that the vector tiles in the MBTILES file are built using the openmaptiles styles)
  3. Load MBTILES file in the assets folder on the Android app
  4. Create a local style file json for vector tiles with a placeholder for a local MBTILES file.
  5. In app code, load local style file, replaced placeholder with MBTILES file uri and add "mbtiles://" before the uri
  6. Save new style file in some location
  7. Open map, load the new style
  8. View MBTILES file locally
  9. For future for loading multiple MBTILES files together, create a local server and point the style file to local server and using local server, serve vector files to the map.

I hope this helps. Please comment any questions you might have. Happy to help.

permanent link

answered 16 Apr '22, 09:18

protos29's gravatar image

protos29
412
accept rate: 0%

edited 16 Apr '22, 09:18

My knowledge here is as a user of OsmAnd not as a developer, but with that caveat in mind:

While OsmAnd can show tiles it primarily stores map data as *.obf files (it's own format) and renders the map from these files. If there is no file for the area you are interested in you can create one yourself with OsmAndMapCreator. There are then different styles within the application for how these should be displayed, for custom styles see links in this section of the OsmAnd wiki page.

permanent link

answered 09 Mar '19, 16:21

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×535
×181
×100
×38

question asked: 09 Mar '19, 15:42

question was seen: 6,351 times

last updated: 16 Apr '22, 09:18

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum