Closed hydroEng closed 2 years ago
What IDE?
Pycharm
The map displays correctly when using jupyter notebook. But even there when rendering to html I get the same problem.
I have not used PyCharm with leafmap before. I guess this is an issue specific to PyCharm. Try the following code. If it doesn't work, then it is an ipyleaflet issue rather than leafmap.
import ipyleaflet m = ipyleaflet.Map() m
I used
import ipyleaflet
m = ipyleaflet.Map()
m.save('my_map.html', title='My Map')
And got the same result in the html. I guess this is an ipyleaflet issue... but thanks for your help anyway.
Somewhat off topic, would the folium backend support using ImageOverlay to plot a raster (using rasterio to bring in a tiff file as an array) and applying a colormap to it (also ignoring nodata values)? I can do all these things in folium itself, but the colormap comes out buggy.
I was hoping to use the ipyleaflet backend's ability to plot a .tiff directly.
Yes, you can use m.add_raster() to load any local raster datasets. It supports both folium and ipyleaflet. It has parameters for custom if color maps.
Amazing. Thank you!
Environment Information
Description
Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.
What I Did
I'm trying to set up a web map using leafmap using the ipyleaflet backend (i.e. the default one).
Writing this in my IDE and running:
Provides me a html with simply a grey box rather than showing the openstreetmap basemap. I've tried adding tile layers but I don't get much luck - for example, when adding ESRI world imagery, a lot of the tiles show as not available even though they work fine when using folium.