arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Offline Mapping

Using maps without an Internet connection is common requirement. Luckily, there are a few options available to you to implement offline mapping in your app.

  • Caching Automatically store tiles as the user loads them through interacting with the map

  • Bulk downloading Download an entire area/region of tiles in one shot, ready for a known no-Internet situation

  • Provide a set of tiles to all users through assets or the filesystem

hashtag
Caching

There's 3 methods that basic caching can be implemented in your app, two of which rely on community maintained plugins:

  1. (lightweight and MIT licensed)

  2. (also includes , but GPL licensed)

  3. Custom implementation, via a and ImageProvider (either custom or via a package such as )

hashtag
Bulk Downloading

When it comes to bulk downloading, this is much more complex than , especially for regions that are a non-rectangular shape. Implementing this can be very time consuming and prone to issues.

The includes advanced bulk downloading functionality, of multiple different region shapes, and other functionality. It is however GPL licensed. To help choose whether FMTC or DIY is more appropriate for your use case, please see:

hashtag
Bundled Map Tiles

If you have a set of custom raster tiles that you need to provide to all your users, you may want to consider bundling them together, to make a them easier to deploy to your users.

There is essentially two options for doing this:

  • Using AssetTileProvider, you can bundle a set of map tiles and register them as an asset within your app's pubspec.yaml. This means that they will be downloaded together with your application, keeping setup simple, but at the expense of a larger application bundle size.

  • Using FileTileProvider, you can bundle a set of map tiles and store them on a remote web server, that can be downloaded from later. This means that the setup may be more complicated for users, but the application's bundle size will be much smaller.

Either way, the filesystem should be structured like this: 'offlineMap/{z}/{x}/{y}.png', where every .png image is a tile.

If you have a raster-format .mbtiles file, for example from TileMill, you should use to convert it to the correct structure first. Alternatively, you can use an external package such as '' to extract during runtime.

Bundling
flutter_map_cachearrow-up-right
flutter_map_tile_cachingarrow-up-right
custom TileProvider
cached_network_imagearrow-up-right
community maintained plugin 'flutter_map_tile_caching'arrow-up-right
mbtilesToPngsarrow-up-right
flutter_mbtiles_extractorarrow-up-right
Bulk Downloading
Caching
Is FMTC Right For Me? | FMTC Docsfmtc.jaffaketchup.devchevron-right
Logo