Giter VIP home page Giter VIP logo

Comments (3)

davidbrochart avatar davidbrochart commented on July 20, 2024

Hi Rosa,

Thanks for the kind words!
The problem is that xarray-leaflet currently expects a coordinate reference system (CRS), and we rely on rioxarray for that. Same for nodata management. I tried your example with the following code and it works on my side:

import rioxarray

da = da.rio.write_crs(4326)  # WGS 84
da = da.rio.write_nodata(np.nan)

l = da.leaflet.plot(m, colormap=plt.cm.viridis)

Please let me know if that solves you issue.

David.

from xarray_leaflet.

rosatrancoso avatar rosatrancoso commented on July 20, 2024

Hi David

Thank you for your swift reply. Indeed it makes sense it needs a projection.

It works now, but only with JupyerNotebook, not with JupyterLab. It seems that, for JupyterLab, LocalTileLayer needs to have path='files/{full_path_since_notebook_origin}/{z}/{x}/{y}.png' (following ipyleaflet issue)

I ran your example notebooks on Jupyter Notebook and they run just fine. I can the same docker image, so no problem.

Thank you so much!
Cheers
Rosa

from xarray_leaflet.

zxdawn avatar zxdawn commented on July 20, 2024

@rosatrancoso I met the same issue in jupyterlab. Could you share how to set the LocalTileLayer?

For example, I have added the crs to data:

from ipyleaflet import Map, basemaps, LayersControl, WidgetControl

m = Map(center=[40, 115], zoom=3, basemap=basemaps.CartoDB.DarkMatter, interpolation='nearest')

data = data.rio.write_crs(4326)  # WGS 84
data = data.rio.write_nodata(np.nan)

data.leaflet.plot(m, colormap='vidiris')

from xarray_leaflet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.