Tile Provider
Interface for providing tiles to a TileOverlay.
Implementations can provide tiles from various sources:
URLs (via UrlTileProvider)
Local storage
Dynamically generated content
Custom tile rendering
Tile coordinates use the Web Mercator projection (EPSG:3857) with the XYZ tile scheme:
x: Tile column (0 to 2^zoom - 1, west to east)
y: Tile row (0 to 2^zoom - 1, north to south)
zoom: Zoom level (0 = world, 19 = building level)
The map calls getTile on a background thread, so it may block, e.g. to read a file or render the tile. Implement it from Kotlin or Java:
val provider = TileProvider { x, y, zoom ->
if (zoom < 10) TileProvider.NO_TILE else Tile(256, 256, renderTile(x, y, zoom))
}Content copied to clipboard
TileProvider provider = (x, y, zoom) ->
zoom < 10 ? TileProvider.NO_TILE : new Tile(256, 256, renderTile(x, y, zoom));Content copied to clipboard