TileLayer: Simplify the max_zoom logic
See original GitHub issueI’m hoping/thinking this might just be a user issue on my end, but it is currently appearing that TileLayer’s max_zoom
value is capped at 18 even after setting it to a higher value. For example, in this MyBinder demo’s example.ipynb
: https://mybinder.org/v2/gh/banesullivan/localtileserver-demo/HEAD which I have modified below:
from localtileserver import examples, get_leaflet_tile_layer, TileClient
from ipyleaflet import Map
# Create a tile server from an raster URL
oam = TileClient('https://oin-hotosm.s3.amazonaws.com/59c66c5223c8440011d7b1e4/0/7ad397c0-bba2-4f98-a08a-931ec3a6e943.tif')
# Create ipyleaflet TileLayer from that server
# Please note that all extra kwargs are passed to `TileLayer`
oam_layer = get_leaflet_tile_layer(oam, max_zoom=24, show_loading=True)
# Create ipyleaflet map, add layers, add controls, and display
m = Map(center=oam.center(), zoom=20, max_zoom=100)
m.add_layer(oam_layer)
m
>>> from ipyleaflet import TileLayer
>>> isinstance(oam_layer, TileLayer)
True
>>> oam_layer.max_zoom
24
No matter how much I zoom in, I can watch the network tab in the browser and see that the tile requests coming from that TileLayer never exceed zoom level 18, e.g., .../proxy/41129/api/tiles/18/85161/117721.png
I know that this image source has a max zoom level of 24
and localtileserver
will continue serving tiles at whatever zoom level is requested regardless of the cap in the data source.
So I’m wondering what is missing here to make sure TileLayer
can continue to fetch tiles beyond zoom level 18.
Additional context
ipyleaflet | CesiumJS |
---|---|
in the share mybinder | https://tileserver.banesullivan.com/?filename=https%3A%2F%2Foin-hotosm.s3.amazonaws.com%2F59c66c5223c8440011d7b1e4%2F0%2F7ad397c0-bba2-4f98-a08a-931ec3a6e943.tif |
This is very high resolution imagery and it’d be fantastic to visualize at full resolution with ipyleaflet
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (17 by maintainers)
Top GitHub Comments
@banesullivan you should not need to provide a
max_zoom
for the Map anymore, its value isNone
by default (like in LeafletJS) which means the map takes the max value of the tile layers max zoom automatically.@XingongLi @giswqs As @davidbrochart was saying, I understand you need to set the
max_native_zoom
property as well.@banesullivan I agree we should simplify this and this sounds like a sensible approach. We could also probably remove the Map’s
max_zoom
property from the Python API and handle it ourselves in ipyleaflet’s JavaScript code.