TileLayer static method
TileLayer
TileLayer(
- String templateUrl, {
- dynamic subdomains = subdomainsDef,
- LatLngBounds? bounds,
- double minZoom = minZoomDef,
- double maxZoom = maxZoomDef,
- double? minNativeZoom,
- double? maxNativeZoom,
- double zoomOffset = zoomOffsetDef,
- bool zoomReverse = false,
- bool crossOrigin = false,
- dynamic tileSize = tileSizeDef,
- double opacity = tileOpacityDef,
- String errorTileUrl = '',
- bool updateWhenZooming = true,
- int updateInterval = updateTileIntervalDef,
- TileProvider tileProvider = tileProviderDef,
- int keepBuffer = keepBufferDef,
- bool tms = tmsDef,
- bool interactive = interactiveDef,
- String attribution = attributionDef,
- dynamic additionalOptions = const <String, dynamic>{},
Used to load and display tile layers on the map.
Example:
U.TileLayer(
templateUrl: 'http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',
subdomains: ['mt0','mt1','mt2','mt3'],
attribution: 'Map Data © Google',
updateInterval: 100,
maxZoom: 20,
minZoom: 0,
)
Alias: TileLayer
Example:
TileLayer(
options: TileLayerOptions(
templateUrl: 'http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',
subdomains: ['mt0','mt1','mt2','mt3'],
attribution: 'Map Data © Google',
updateInterval: 100,
maxZoom: 20,
minZoom: 0,
),
)
@param: templateUrl
A string of the following form:
'http://{s}.somemap.com/blabla/{z}/{x}/{y}{r}.png'
{s}
means one of the available subdomains (used sequentially to help
with browser parallel requests per domain limitation.
subdomain values are specified in options (a
, b
or c
by default, can be omitted),
{z}
— zoom level, {x}
and {y}
— tile coordinates.
{r}
can be used to add "@2x" to the URL to load retina tiles.
Implementation
// ignore: non_constant_identifier_names
static L.TileLayer TileLayer(
String templateUrl, {
dynamic subdomains = subdomainsDef,
LatLngBounds? bounds,
double minZoom = minZoomDef,
double maxZoom = maxZoomDef,
double? minNativeZoom,
double? maxNativeZoom,
double zoomOffset = zoomOffsetDef,
bool zoomReverse = false,
bool crossOrigin = false,
dynamic tileSize = tileSizeDef,
double opacity = tileOpacityDef,
String errorTileUrl = '',
bool updateWhenZooming = true,
int updateInterval = updateTileIntervalDef,
L.TileProvider tileProvider = tileProviderDef,
int keepBuffer = keepBufferDef,
bool tms = tmsDef,
bool interactive = interactiveDef,
String attribution = attributionDef,
dynamic additionalOptions = const <String, dynamic>{},
}) {
return L.TileLayer(
options: L.TileLayerOptions(
templateUrl: templateUrl,
subdomains: subdomains,
minZoom: minZoom,
maxZoom: maxZoom,
zoomOffset: zoomOffset,
zoomReverse: zoomReverse,
tileSize: tileSize,
opacity: opacity,
updateInterval: updateInterval,
minNativeZoom: minNativeZoom,
maxNativeZoom: maxNativeZoom,
tileProvider: tileProvider,
tms: tms,
keepBuffer: keepBuffer,
interactive: interactive,
attribution: attribution,
additionalOptions: additionalOptions,
),
);
}