2

Showing an offline map using 1 Mapsforge OSM map file is only possible in a HTML5 webapp using commercial tools like Mapbox. There are simply no free tools to do so, as you can read in this post.

Is it possible to show an offline Mapsforge OSM map in an Progressive Web App? That would really be great.

Why an offline Mapsforge file? It is a free and good OSM map. It is available as 1 file per (great) area, so not a huge bunch of small files in a x/y/z folder.

tm1701
  • 7,307
  • 17
  • 79
  • 168

1 Answers1

1

After scanning solutions, I think there is a better alternative for accessing offline OSM maps via mapsforge. The solution is for caching OSM map requests. Using that approach you don't need to pre-load the mapsforge data. You just browse the area. An alternative is to start a 'seed' in order to pre-fetch lower levels of OSM data.

Caching map requests are possible in a number of ways. As a first introduction, I refer to a recommendation for storing data offline:

For URL addressable resources, use the Cache API (part of Service Worker). For all other data, use IndexedDB (with a Promises wrapper).

tm1701
  • 7,307
  • 17
  • 79
  • 168
  • Hi, when you said "seed" what are you talking exactly? Thanks! – Federico González Brizzio Apr 21 '18 at 13:19
  • 'Seed' means that you retrieve all underlying map levels. If you just get a map on exactly 1 level, say 17, and you go offline, then you cannot zoom in to lower levels. You did not retrieve the levels 18, 19, etc. – tm1701 Apr 21 '18 at 14:54