androidgoogle-mapsfluttermapboxmaproute

Flutter offline map routing


while developing my Flutter application(Android only, no iOS support) I ran into a problem.

Use-case is that a user while online downloads a map route directions from Google Maps API/MapBox(yet to be decided which will be used in final build) in JSON/XML format and saves on device. Then while offline use this route to navigate.

Application is aimed at hikers, runners, cyclists etc. so there is requirement to be able to correctly navigate user if he pre-downloaded the route.

My problem is that I can´t find right plugin for Flutter to do the navigation. The application is final thesis in my university studies, so the requirement is to use only Flutter and Flutter plugins to do the work and donť write or use any Android native code/SDK/plugins.


Solution

  • Since Google doesn't allow the downloading of offline maps, and Mapbox is a prepacked service, it is unlikely that using either of them will work. You could, however, use Mapbox to display your map. Then use OpenStreetMap data to do the navigation part. The two will have the same map data because Mapbox uses OpenStreetMap data. You can download OpenStreetMap data from planet.openstreetmap.org. There are also some other sources where you can download smaller portions of map data (single countries). Mapbox cashes all the map data where the user has navigated.

    Although this approach would work, it is pretty difficult. Using a service like Mapbox Navigation would make more sense and would save you a lot of time.