4

I try to reproduce the example at https://localtileserver.banesullivan.com/. Unfortunately, the raster map is not displayed. I see only the OSM basemap. I am working in a Jupyterhub environment (Version 3.3.2) under Python 3.8.10

The example code looks like:

from localtileserver import get_leaflet_tile_layer, examples
from ipyleaflet import Map

# Create a TileClient from a raster file
tile_client = examples.get_san_francisco()

# Create ipyleaflet TileLayer from that server
t = get_leaflet_tile_layer(tile_client)
# Create ipyleaflet map, add tile layer, and display
m = Map(center=tile_client.center(), zoom=10)
m.add_layer(t)
m

Result with missing raster

Expected outcome: Result with raster

Does anybody have an idea how I can solve this?

Thank you!

1 Answers1

1

I was facing the same problem. I was running jupyter on a remote JupyterHub environment.

The solution in this case is to enable the jupyter-proxy-server extension and adjust the LOCALTILESERVER_CLIENT_PREFIX accordingly.

For me the concrete solution was including the following in my notebook:

import os
os.environ['LOCALTILESERVER_CLIENT_PREFIX'] = f"{os.environ['JUPYTERHUB_SERVICE_PREFIX']}/proxy/{{port}}"

More details can be found in the following documentation page:

https://localtileserver.banesullivan.com/installation/remote-jupyter.html

There is some further discussion here.

LuizFelippe
  • 172
  • 9