Tile Layer#
Example#
from ipyleaflet import Map, basemaps, basemap_to_tiles
m = Map(center=(52.204793, 360.121558), zoom=9)
dark_matter_layer = basemap_to_tiles(basemaps.CartoDB.DarkMatter)
m.add_layer(dark_matter_layer)
m
Usage#
Creating a TileLayer
is straightforward, a dictionary containing basic tile layers is provided.
This dictionary is named basemaps
.
A TileLayer
instance can be created using the basemap_to_tiles
function, specifying the wanted map
(e.g. basemaps.CartoDB.DarkMatter
, basemaps.Strava.Winter
, basemaps.NASAGIBS.ModisTerraTrueColorCR
, …).
Sometimes one could want to specify the date of the given images, for instance with NASA images:
nasa_layer = basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2018-04-08");
m.add_layer(nasa_layer);
Attributes and methods#
- class ipyleaflet.leaflet.TileLayer(**kwargs)[source]#
TileLayer class.
Tile service layer.
- url#
Url to the tiles service.
- Type
string, default “https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png”
- min_zoom#
Minimum zoom for this tile service.
- Type
int, default 0
- max_zoom#
Maximum zoom for this tile service.
- Type
int, default 18
- min_native_zoom#
- Type
int, default 0
- max_native_zoom#
- Type
int, default 18
- bounds#
List of SW and NE location tuples. e.g. [(50, 75), (75, 120)].
- Type
list or None, default None
- tile_size#
Tile sizes for this tile service.
- Type
int, default 256
- attribution#
Tiles service attribution.
- Type
string, default “Map data (c) <a href=”https://openstreetmap.org”>OpenStreetMap</a> contributors”
- no_wrap#
Whether the layer is wrapped around the antimeridian.
- Type
boolean, default False
- tms#
If true, inverses Y axis numbering for tiles (turn this on for TMS services).
- Type
boolean, default False
- show_loading#
Whether to show a spinner when tiles are loading.
- Type
boolean, default False
- loading#
Whether the tiles are currently loading.
- Type
boolean, default False (dynamically updated)
- detect_retina#
- Type
boolean, default False
- opacity#
- Type
float, default 1.0
- visible#
- Type
boolean, default True