Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xarray content not displayed #1021

Closed
niowniow opened this issue Dec 13, 2024 · 5 comments · Fixed by #1023
Closed

xarray content not displayed #1021

niowniow opened this issue Dec 13, 2024 · 5 comments · Fixed by #1023
Labels
bug Something isn't working

Comments

@niowniow
Copy link
Contributor

niowniow commented Dec 13, 2024

Environment Information

  • leafmap version: 0.42.5
  • Operating System: Linux
  • Browser: Firefox, Chromium

I'm not using conda to manage the dependencies, only pypi packages.

Description

The xarray-based examples on the leafmap website are not showing any content, e.g. the xarray part on 49_split_control. The same issue occurs when running the example in Colab. (JupyterLite and Binder fail for other reasons).

I experience a similar issue when running a marimo notebook plotting a leafmap from within a docker container. Running the notebook without docker container runs it just fine, but from within the docker container it does not work.

Could there be any dependencies missing which make it silently fail? I wouldn't know where to start debugging, since there are no warning or error messages.

There are no logs

What I Did

  • Look at various xarray examples on the webpage, no content is shown

Relevant localtileserver issue and leafmap discussion. Note: I understand that this is a localtileserver issue, however, this is mainly about the non-working examples of leafmap.

@niowniow niowniow added the bug Something isn't working label Dec 13, 2024
@giswqs
Copy link
Member

giswqs commented Dec 14, 2024

Try openning the network tab in the Chrome Developer Console and see what errors in the tile URLs.

@giswqs
Copy link
Member

giswqs commented Dec 14, 2024

You also need to install jupyter-server-proxy.

@giswqs
Copy link
Member

giswqs commented Dec 14, 2024

It seems there is a bug with the folium backed. The ipyleaflet backend works fine.

import leafmap

m = leafmap.Map(center=[37.6, -119], zoom=9)
m.split_map(
    dem_ds,
    dem_class,
    left_args={"layer_name": "DEM", "colormap": "terrain"},
    right_args={"layer_name": "Classified DEM", "colormap": "coolwarm"},
)
m

image

@niowniow
Copy link
Contributor Author

niowniow commented Jan 3, 2025

Thanks a lot!

You also need to install jupyter-server-proxy.

Installing jupyter-server-proxy is not fixing the issue on my side. Maybe because I'm not using jupyter notebooks.

My main issue is that add_raster or related calls, starts a localtileserver on a non-deterministic port on localhost. This port is only accessible in the docker container. I assume jupyter-server-proxy would reverse proxy that port.

In my case, if I could set the port explicitly, I would be able to forward the port and it works. I did that by scraping the port from the browsers network tab. However whenever I restart my app, the localtileserver is started on a different port.

Do you know if it's possible to fix the localtileserver port to a specific number in the call to add_raster?

@giswqs
Copy link
Member

giswqs commented Jan 3, 2025

The add_raster method has the port parameter for setting the port number

https://localtileserver.banesullivan.com/api/index.html#localtileserver.get_leaflet_tile_layer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants