pbugnion / gmaps

Google maps for Jupyter notebooks
https://jupyter-gmaps.readthedocs.io/en/stable/
Other
760 stars 147 forks source link

Directions layer not showing via `embed_minimal_html` #351

Open akazachk opened 3 years ago

akazachk commented 3 years ago

Hello, I am just starting out with this package (thank you for it!), and trying to following the examples, including the instructions here:

https://jupyter-gmaps.readthedocs.io/en/latest/export.html

However, the directions layer is not showing up, which may be the same issue raised on this StackOverflow issue.

Specifically, I am trying:

# Latitude-longitude pairs
geneva = (46.2, 6.1)
montreux = (46.4, 6.9)
zurich = (47.4, 8.5)

fig = gmaps.figure()
geneva2zurich = gmaps.directions_layer(geneva, zurich)
fig.add_layer(geneva2zurich)
fig

from ipywidgets.embed import embed_minimal_html

filename = 'export.html'
embed_minimal_html(filename, views=[fig])

import IPython
IPython.display.HTML(filename=filename)

The fig command works fine in a local Jupyter notebook, but embed_minimal_html does not: the map shows up, but not the directions layer. There are a few issues that are suggested by the Jupyter notebook:

Screen Shot 2021-07-02 at 13 56 08

When inspecting this more, I see a couple of warnings/errors corresponding to those broken links. One is InvalidValueError: in property travelMode: undefined and the others (corresponding to the red broken link icons in the picture) are variants of jupyter-widgets-disconnected.

If I try to open the "export.html" file outside of Jupyter, I get two errors: one is the same InvalidValueError related to travelMode, and the other is Not allowed to load local resource: file:///Users/akazachk/repos/bread_of_the_mighty/jupyter-gmaps.js.

Any help would be greatly appreciated. Thank you in advance.

Dyleee commented 2 years ago

lol