Tile Providers
A TileProvider
works with a TileLayer
to supply tiles (usually images) when given tile coordinates.
Tile providers may support compatible caching providers (including built-in caching), or may implement caching themselves.
Tiles are usually dynamically requested from the network/Internet, using the default NetworkTileProvider
. Tiles can also come from the app's assets, the filesystem, a container/bundle, or any other source.
NetworkTileProvider
NetworkTileProvider
This tile provider uses the TileLayer.urlTemplate
to get the appropriate tile from the a network, usually the Internet.
Specifying any fallbackUrl
(even if it is not used) in the TileLayer
will prevent loaded tiles from being cached in memory.
This is to avoid issues where the urlTemplate
is flaky (sometimes works, sometimes doesn't), to prevent potentially different tilesets being displayed at the same time.
For more information, check the API documentation.
Local Tile Providers
These tile providers use the urlTemplate
to get the appropriate tile from the asset store of the application, or from a file on the users device, respectively.
Specifying any fallbackUrl
(even if it is not used) in the TileLayer
will reduce the performance of these providers.
It will cause 23% slower asset tile requests with AssetTileProvider
, and will cause main thread blocking when requesting tiles from FileTileProvider
.
AssetTileProvider
AssetTileProvider
This tile providers uses the templateUrl
to get the appropriate tile from the asset store of the application.
FileTileProvider
FileTileProvider
This tile providers uses the templateUrl
to get the appropriate tile from the a path/directory/file on the user's device - either internal application storage or external storage.
On the web, FileTileProvider()
will throw an UnsupportedError
when a tile request is attempted, due to the lack of the web platform's access to the local filesystem.
If you know you are running on the web platform, use a NetworkTileProvider
or a custom tile provider.
Offline Mapping
Offline MappingLast updated
Was this helpful?