Skip to content

Commit

Permalink
Merge pull request #907 from davidbrochart/tilelayer_bounds
Browse files Browse the repository at this point in the history
Add bounds attribute to TileLayer
  • Loading branch information
martinRenou authored Dec 21, 2021
2 parents cfb3669 + e6bce26 commit 3273696
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/api_reference/tile_layer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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) <a href=\'https://openstreetmap.org\'>OpenStreetMap</a> contributors"
detect_retina False
Expand Down
3 changes: 3 additions & 0 deletions ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) <a href="https://openstreetmap.org">OpenStreetMap</a> contributors"
Expand All @@ -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) <a href="https://openstreetmap.org">OpenStreetMap</a> contributors').tag(
sync=True, o=True)
Expand Down
1 change: 1 addition & 0 deletions js/src/layers/TileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/notebooks/SplitMapControl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3273696

Please sign in to comment.