My phone’s data plan is 500/MB per month. This low cap makes me think very conservatively about what gets sent across the modem as I’m going about my day.
While a good source of information, the OpenStreetMap Wiki is not viewable offline. There is no native app nor a PWA to use. The ZIM files from Kiwix are very outdated (at the time of writing).
A clever solution is to retrofit the existing Wikipedia App for Android, which already has a “Save page offline” feature and a very nice interface. It might even be as simple as changing the urls. After all, most Wiki sites share a similar backend and API, called Mediawiki, and I was hoping to hook into this feature.
The primary reason for this retrofit’s difficulty is Wikipedia’s different (slightly proprietary) rest API. It isn’t shared with the mediawiki suite. This is outlined very clearly in the API comparison table.
OK, so a lot more needs to change for OSM to wriggle its way into this app.
‘Simply’ Changing the URLs
I had some promising results after changing the base
rest_api URL to the ‘old’ Mediawiki target. Search now works immediately.
However, internal pages didn’t work. Each wiki page in the app expects a well formatted summary from the API.
I could get around this by changing the request for a
/summary to the full
/html of that article, and now we’re getting closer.
Of course there were some other bugs that needed to be ironed out, but those didn’t seem critical. Mainly CSS and indexing issues.
Save to Offline did not work, I’m not sure why yet.
At this point I’m unsure if retrofitting the Wikipedia app is worth it. Rigging the app enough to do what I want would entail only a few more things:
- Custom CSS injection to fix the worst of the
- Figure out why Save Offline doesn’t work.
I’m working on this now in my little free time.
100% by-the-booke correct
To do this properly, and not rigged just enough for Quinn’s phone, we would need way more. All the following:
- A well-formatted response (or converted response) from the Mediawiki API that is not in a Wiki format nor the ugly HTML. Markdown with inline images would be great.
- The remainder of the
rest_v1endpoints converted in the App’s RestService.kt and subsequent serializers.
- Reworking the Save to Offline feature, adapting the new (old) responses to the underlying SQLite schema.
I’m not jazzed at those prospects, even less so when you consider keeping up to date with upstream.
I’ll continue to try rigging it.
My Other Idea for Offline OSM Wiki
I’d like to investigate
- How Kiwix packages wikis into openZIM format.
- If I can do this for OpenStreetMap on a more regular basis.
- If I can build a slightly nicer app to parse custom
- What do
.zimsknow, do they know things? Let’s find out.