Has anybody integrated offline mapping into an offline Ionic app?

Just wondering if anyone had managed to get offline mapping working on an Ionic app?

I need to have osm map downloads per country so leaflet tile downloads won’t cut it.

Mapbox maybe?

2 Likes

I need to have osm map downloads per country so leaflet tile downloads won’t cut it.

Are you trying to embed entire regions for offline use? Looks like mapbox provides this functionality, although I haven’t personally used it.

The @ionic-native/google-maps plugin will provide offline functionality for areas that the user has already cached, which was sufficient for my project (but may not be for apps that allow the user to explore beyond their locality while offline).

Is it possible fully offline app with google-maps-plugin? because when I made a app with the plugin, the plugin requires internet connection to get a Google Maps Javascript API v3. the error is like below.

CordovaGoogleMaps.js:57 GET https://maps.googleapis.com/maps/api/js net::ERR_INTERNET_DISCONNECTED
document.addEventListener.once @ CordovaGoogleMaps.js:57
CordovaGoogleMaps.js:45 Can not load the Google Maps JavaScript API v3
CordovaGoogleMaps.js:46 Event {isTrusted: true, type: “error”, target: script, currentTarget: script, eventPhase: 2, …}

The cordova google maps plugin plugin provided by @wf9a5m75 at [https://github.com/mapsplugin/cordova-plugin-googlemaps] works just fine when offline.

Again, if the user does not have imagery for their locality cached - you won’t be able to see details on the map. This isn’t a solvable problem according to google tos (item 4.4):

https://enterprise.google.com/maps/terms/us/maps_purchase_agreement.html

2 Likes

@GypsyBone Do you happen to know if there is a way to download the google map for a certain area to the cache for the user within the app? This would be the ideal solution.

In case the above link goes stale, Item 4.4 in the link above states:

Customer may not pre-fetch, retrieve, cache, index, or store any Content, or portion of the Services with the exception being Customer may store limited amounts of Content solely to improve the performance of the Customer Implementation due to network latency, and only if Customer does so temporarily, securely, and in a manner that (a) does not permit use of the Content outside of the Services; (b) does not manipulate or aggregate any Content or portion of the Services; (c) does not prevent Google from accurately tracking usage; and (e) does not modify attribution in any way.

I know Google’s Google Maps apps provide offline caching (to use with navigation, for example), but third party apps (we) are more restricted than that.

That being said, a view that you ‘show’ the user while they’re online will be cached.

If precaching for offline mode is a requirement for your app I think leaflet and mapbox are better options.