1

I'm trying to overlay an esri bathymetry map on my south polar stereographic map using the 'url' function in ipyleaflet. Doing this results with {z}/{y}/{x} in the url inserts the layer, but at a smaller size in the right-hand corner of the basemap. I tried to give the tilelayer the same crs, but that did not change the output. My code is as such:

from ipyleaflet import (
    Map,
    basemaps,
    TileLayer,
    basemap_to_tiles,
    projections) 
from ipywidgets import (Layout, 
    widgets as w 
tile_layer = TileLayer(url='https://tiles.arcgis.com/tiles/C8EMgrsFcRFL6LrL/arcgis/rest/services/Antarctic_Basemap/MapServer/tile/{z}/{y}/{x}')
spsLayout = Layout(width='800px', height='800px')


m = Map(center=(-90, 0),
        zoom=0,
        layout=spsLayout,
        basemap= basemaps.NASAGIBS.BlueMarble3031,
        crs=projections.EPSG3031) 
m.add_layer(tile_layer)

m 

Here's where I got the url for the tiles In the bottom right. Thanks for your help!

VikingMK
  • 13
  • 3

1 Answers1

0

I think the issue here is that this bathymetry base map use a different tilegrid(metatiles 3x3) from the one used with ipyleaflet(4x4). Unfortunately I don't think there is currently a way for Leaflet(hence ipyleaflet) to understand multiple tilegrids in the same map. A workaround would be to use ArcGIS in your notebook instead of ipyleaflet but that would require a paid subscription.

If you don't mind defining your own projection and resolutions you can use the ArcGIS layers and avoid completely thedefault polar projection and basemaps from ipyleaflet. i.e.

from ipyleaflet import (
    Map,
    basemaps,
    TileLayer,
    basemap_to_tiles,
    projections) 

ESRI_3031 = dict(
    name='EPSG:3031',
    custom=True,
    proj4def="""+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1
        +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs""",
    origin=[-3.06361E7, 3.0636099999999993E7],
    resolutions=[
        67733.46880027094,
        33866.73440013547,
        16933.367200067736,
        8466.683600033868,
        4233.341800016934,
        2116.670900008467,
        1058.3354500042335,
        529.1677250021168,
        264.5838625010584,
    ],
    bounds=[
        [-4524583.19363305,-4524449.487765655],
        [4524449.4877656475,4524583.193633042]
    ]
)

tile_layer = TileLayer(url='https://tiles.arcgis.com/tiles/C8EMgrsFcRFL6LrL/arcgis/rest/services/Antarctic_Basemap/MapServer/tile/{z}/{y}/{x}')
spsLayout = Layout(width='800px', height='800px')


m = Map(center=(-90, 0),
        zoom=0,
        layout=spsLayout,
        basemap= tile_layer,
        crs=ESRI_3031) 
m 
betolink
  • 113
  • 1
  • 7
  • Thank you for the response! Shame about the tilegrid. – VikingMK Jun 06 '22 at 14:57
  • If you don't mind defining your own projection and resolutions you can use the ArcGIS layers and avoid completely thedefault polar projection and basemaps from ipyleaflet. i.e. – betolink Jun 06 '22 at 20:43
  • @VikingMK I edited my response to provide another way of using ESRI's base layer, keep in mind that your map projection and the layers you use have to use the same tiling scheme. – betolink Jun 06 '22 at 20:50
  • I was able to get your custom projection working! Thank you! – VikingMK Jun 08 '22 at 17:27