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

Matplotlib palette error #190

Closed
orttak opened this issue Jan 23, 2022 · 4 comments
Closed

Matplotlib palette error #190

orttak opened this issue Jan 23, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@orttak
Copy link

orttak commented Jan 23, 2022

  • leafmap version: latest
  • Python version: 3.7, 3.8 and 3.9
  • Operating System: In docker ubuntu:20 , python3.7 base image and pangeo notebook

import leafmap
m = leafmap.Map()
dem_path='CGIAR_SRTM90_V4.tif' #same folder with notebook
m.add_local_tile(ndvi_path,palette='matplotlib.Viridis_10',layer_name="NDVI")

I try to install leafmap in docker env and
I got below error when I try add local raster. It could be realted with localtileserver or ipyleaflet but I am not sure which one.

What I Did

I am working on Win-11 anaconda env. In my local anaconda env, everything is fine but when I try it in docker it doesn't work.

image

@orttak orttak added the bug Something isn't working label Jan 23, 2022
@giswqs
Copy link
Member

giswqs commented Jan 23, 2022

Use viridis. See https://leafmap.org/notebooks/32_local_tile/

@giswqs giswqs closed this as completed Jan 23, 2022
@orttak
Copy link
Author

orttak commented Jan 23, 2022

m.add_local_tile(dem, palette='viridis', layer_name="DEM") > This sample code works fine in local anaconda env but when I try to use in in docker env which is

ubuntu:18
install conda
your instruction from leafmap
I use jupyter notebook, not jupyter lab

I try with all type of path(I saw from your github comment, we should use relative path) and map seems empty.

image

@giswqs
Copy link
Member

giswqs commented Jan 23, 2022

This is likely a localtileserver issue. Try the following example without using leafmap. If it doesn't work, then it is a localtileserver issue. You might want to try out the localtileserver docker image rather than creating your own docker image.

This issue might also be related to banesullivan/localtileserver-demo#1

from localtileserver import get_leaflet_tile_layer, TileClient
from ipyleaflet import Map

# First, create a tile server from local raster file
tile_client = TileClient('path/to/your/dem.tif')

# Create ipyleaflet tile layer from that server
t = get_leaflet_tile_layer(tile_client)

# Create ipyleaflet map, add tile layer, and display
m = Map(center=tile_client.center())
m.add_layer(t)
m

@orttak
Copy link
Author

orttak commented Jan 23, 2022

You right Sir. it doesn't work with localtileserver sample. I also tried with Binder but it was all same.
Thank you for your response

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

No branches or pull requests

2 participants