ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

Saving map to html creates a blank webpage

Open sromano opened this issue 2 years ago • 11 comments

Saving the map to html runs without any issue. However, when opening the HTML, the page is blank.

Related old issue https://github.com/jupyter-widgets/ipyleaflet/issues/841 (although now the problem seems different so I'm opening a new on)

Tested on 0.17.2 and 0.17.1

In Colab I simply run:

!pip install -U ipyleaflet
import ipyleaflet
m = ipyleaflet.Map()
m.save('mymap.html')

and the resulting mymap file does not work in Chrome due to NaN in tile resources https://tile.openstreetmap.org/NaN/2047/2047.png

Same happens with the basic example:

from ipyleaflet import Map, basemaps, basemap_to_tiles

m = Map(
    basemap=basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2017-04-08"),
    center=(52.204793, 360.121558),
    zoom=4
)

Console shows 404 of different resources due to "NaN" in the TILEMATRIX https://map1.vis.earthdata.nasa.gov/wmts-webmerc/MODIS_Terra_CorrectedReflectance_TrueColor/default/2017-04-08/GoogleMapsCompatible_Level9/NaN/5/7.jpg

html.zip

sromano avatar Jan 13 '23 18:01 sromano

It works in 0.17.0 (the error started on 0.17.1)

sromano avatar Jan 13 '23 19:01 sromano

It seems related to zoom in tile changes: @martinRenou @ned2

sromano avatar Jan 13 '23 19:01 sromano

It is probable that this PR https://github.com/jupyter-widgets/ipyleaflet/pull/1068 fixes it (only on the master branch for now) and that the next release will fix this

martinRenou avatar Jan 23 '23 08:01 martinRenou

I just tested the master branch and it did not work for me. If I run pip freeze, I do see the local package

ipykernel                         6.20.2
ipyleaflet                        0.17.2      /Users/rene/Development/Notebooks/ipyleaflet
ipython                           8.9.0

but the save method still returns a blank map for me

m.save("my_map.html", title="My Map")

My best bet would be that it is somehow related to the introduced zoom_offset in 0.17.1 but I don't really understand why?

Empty Map: Screenshot 2023-02-02 at 17 51 18

400 Bad Request errors from openstreetmap.org Screenshot 2023-02-02 at 17 51 33

filipre avatar Feb 02 '23 16:02 filipre

Using ipyleaflet master will not save you unfortunately, because your HTML page will not use your dev installation but the released one (fetched from online source). We need to release ipyleaflet.

martinRenou avatar Feb 03 '23 08:02 martinRenou

Sorry to bug you guys but any timeline on getting a new release with the fix out?

philippjfr avatar May 31 '23 11:05 philippjfr

This is an issue for us as well, trying to build a jupyter book with ipyleaflet maps in it and hitting this. A release would be much appreciated 🙏🏻

cc @ahernank

alimanfoo avatar Jun 01 '23 17:06 alimanfoo

Btw we are instantiating a Map with an initial zoom level and we still see this, so perhaps #1068 will not fix this after all?

alimanfoo avatar Jun 01 '23 17:06 alimanfoo

@alimanfoo our issue (NaN in tiles, as described above) seems to be solved by using 0.17.0. FWIW, I tried using 0.16.0 earlier today, which also wasn't working..

ahernank avatar Jun 01 '23 19:06 ahernank

Thanks for pinging. I'll do a release.

martinRenou avatar Jun 02 '23 06:06 martinRenou

Done!

martinRenou avatar Jun 02 '23 07:06 martinRenou