question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GMap in Notebook unreliable again

See original GitHub issue

I believe (but have not yet confirmed) that this happened in the 0.12.6dev2 to dev3 time frame, which would possibly implicate the big layout PR.

Behavior is for plot areas to render solid grey on the first show but often render correctly after a save and reload of the notebook. No out of the ordingary JS console messages or errors.

ping @mattpap

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, May 30, 2017

@mattpap I’ll take a look at this tomorrow since you can’t reproduce. My concern is just clashing with any layout code that is not in a branch/PR yet.

1reaction
syonekuracommented, May 26, 2017

I’m sorry, I said similar in the sense that I get the same output (gray map), but with a different workflow on 0.12.5, I should’ve specified that. So maybe this is another bug, but I guess that’s related to this one (and hope that it helps in someway to detect it).

In 0.12.5 the first run plots the map without problems. The second run shows a gray map. This is the code I used:

from __future__ import print_function

from bokeh.io import show, output_notebook
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
    GMapPlot, Range1d, ColumnDataSource, PanTool, WheelZoomTool, BoxSelectTool, GMapOptions,
    LinearAxis, MercatorTickFormatter, MercatorTicker, Label)
from bokeh.resources import INLINE

output_notebook()

x_range = Range1d()
y_range = Range1d()

# JSON style string taken from: https://snazzymaps.com/style/1/pale-dawn
map_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=13, styles="""
[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}]
""")

# Google Maps now requires an API key. You can find out how to get one here:
# https://developers.google.com/maps/documentation/javascript/get-api-key
API_KEY = 'API KEY'

plot = GMapPlot(
    x_range=x_range, y_range=y_range,
    map_options=map_options,
    api_key=API_KEY,
)

plot.title.text = "Austin"

source = ColumnDataSource(
    data=dict(
        lat=[30.2861, 30.2855, 30.2869],
        lon=[-97.7394, -97.7390, -97.7405],
        fill=['orange', 'blue', 'green']
    )
)

circle = Circle(x="lon", y="lat", size=15, fill_color="fill", line_color="black")
plot.add_glyph(source, circle)

pan = PanTool()
wheel_zoom = WheelZoomTool()
box_select = BoxSelectTool()

plot.add_tools(pan, wheel_zoom, box_select)

xformatter = MercatorTickFormatter(dimension="lon")
xticker = MercatorTicker(dimension="lon")
xaxis = LinearAxis(formatter=xformatter, ticker=xticker)
plot.add_layout(xaxis, 'below')

yformatter = MercatorTickFormatter(dimension="lat")
yticker = MercatorTicker(dimension="lat")
yaxis = LinearAxis(formatter=yformatter, ticker=yticker)
plot.add_layout(yaxis, 'left')

show(plot)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Google map does not display correctly in jupyter notebook
I'm trying to use google map API to visualize some data in jupyter notebook. Here is the code I used to display basic...
Read more >
Find & improve your location's accuracy - - Google Help
If the GPS location of your blue dot on the map is inaccurate or missing, you can take steps to help fix the...
Read more >
Compared: Apple Maps versus Google Maps in 2022
Apple Maps vs. Google Maps: getting directions. Both apps excel at simply providing turn-by-turn directions. Again, Google offers more layers of ...
Read more >
Getting started — gmaps 0.8.3-dev documentation
gmaps is a plugin for Jupyter for embedding Google Maps in your notebooks. It is designed as a data visualization tool. This gives...
Read more >
Google Maps
Unable to connect to Google Maps. Please try again.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found