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)
Example implementation:
class CustomTileProvider : TileProvider {
override suspend fun getTile(x: Int, y: Int, zoom: Int): Tile? {
// Return tile data or null if tile is not available
return Tile(256, 256, pngByteArray)
}
}Content copied to clipboard