diff --git a/docs/source/api_reference/tile_layer.rst b/docs/source/api_reference/tile_layer.rst index 2f1c11d8a..603efe0b0 100644 --- a/docs/source/api_reference/tile_layer.rst +++ b/docs/source/api_reference/tile_layer.rst @@ -42,6 +42,7 @@ min_zoom 0 max_zoom 18 min_native_zoom 0 max_native_zoom 18 +bounds None tile_size 256 attribution "Map data (c) OpenStreetMap contributors" detect_retina False diff --git a/ipyleaflet/leaflet.py b/ipyleaflet/leaflet.py index 7682b3aeb..258bd06e2 100644 --- a/ipyleaflet/leaflet.py +++ b/ipyleaflet/leaflet.py @@ -529,6 +529,8 @@ class TileLayer(RasterLayer): Minimum zoom for this tile service. max_zoom: int, default 18 Maximum zoom for this tile service. + bounds: list or None, default None + List of SW and NE location tuples. e.g. [(50, 75), (75, 120)]. tile_size int, default 256 Tile sizes for this tile service. attribution string, default "Map data (c) OpenStreetMap contributors" @@ -552,6 +554,7 @@ class TileLayer(RasterLayer): max_zoom = Int(18).tag(sync=True, o=True) min_native_zoom = Int(0).tag(sync=True, o=True) max_native_zoom = Int(18).tag(sync=True, o=True) + bounds = List(default_value=None, allow_none=True, help='list of SW and NE location tuples').tag(sync=True, o=True) tile_size = Int(256).tag(sync=True, o=True) attribution = Unicode('Map data (c) OpenStreetMap contributors').tag( sync=True, o=True) diff --git a/js/src/layers/TileLayer.js b/js/src/layers/TileLayer.js index 2ba19603b..41a4529c6 100644 --- a/js/src/layers/TileLayer.js +++ b/js/src/layers/TileLayer.js @@ -15,6 +15,7 @@ export class LeafletTileLayerModel extends rasterlayer.LeafletRasterLayerModel { url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', min_zoom: 0, max_zoom: 18, + bounds: null, tile_size: 256, attribution: 'Map data (c) OpenStreetMap contributors', diff --git a/ui-tests/notebooks/SplitMapControl.ipynb b/ui-tests/notebooks/SplitMapControl.ipynb index b73d3faca..0b46e3ca7 100644 --- a/ui-tests/notebooks/SplitMapControl.ipynb +++ b/ui-tests/notebooks/SplitMapControl.ipynb @@ -9,7 +9,7 @@ "source": [ "from ipyleaflet import Map, basemaps, basemap_to_tiles, SplitMapControl\n", "\n", - "m = Map(center=(42.6824, 365.581), zoom=5)\n", + "m = Map(center=(44.15, 359.475), zoom=6)\n", "control = SplitMapControl()\n", "m.add_control(control)\n", "\n", diff --git a/ui-tests/tests/ipyleaflet.test.ts-snapshots/SplitMapControl-linux.png b/ui-tests/tests/ipyleaflet.test.ts-snapshots/SplitMapControl-linux.png index bba86ed34..c5f3568f7 100644 Binary files a/ui-tests/tests/ipyleaflet.test.ts-snapshots/SplitMapControl-linux.png and b/ui-tests/tests/ipyleaflet.test.ts-snapshots/SplitMapControl-linux.png differ