TileLayer static method

TileLayer TileLayer(
  1. String templateUrl, {
  2. dynamic subdomains = subdomainsDef,
  3. LatLngBounds? bounds,
  4. double minZoom = minZoomDef,
  5. double maxZoom = maxZoomDef,
  6. double? minNativeZoom,
  7. double? maxNativeZoom,
  8. double zoomOffset = zoomOffsetDef,
  9. bool zoomReverse = false,
  10. bool crossOrigin = false,
  11. dynamic tileSize = tileSizeDef,
  12. double opacity = tileOpacityDef,
  13. String errorTileUrl = '',
  14. bool updateWhenZooming = true,
  15. int updateInterval = updateTileIntervalDef,
  16. TileProvider tileProvider = tileProviderDef,
  17. int keepBuffer = keepBufferDef,
  18. bool tms = tmsDef,
  19. bool interactive = interactiveDef,
  20. String attribution = attributionDef,
  21. 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 &copy; 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 &copy; 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,
    ),
  );
}