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

GMapPlot Resets to (0, 0) #2822

Closed
avanetten opened this issue Sep 8, 2015 · 2 comments · Fixed by #5693
Closed

GMapPlot Resets to (0, 0) #2822

avanetten opened this issue Sep 8, 2015 · 2 comments · Fixed by #5693

Comments

@avanetten
Copy link

ResetTool() for GmapPlot centers on lat, lon = (0,0), rather than the lat, lon defined in GMapOptions.

from __future__ import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
    GMapPlot, GeoJSPlot, Range1d, ColumnDataSource, LinearAxis,
    PanTool, WheelZoomTool, BoxSelectTool, ResetTool,
    BoxSelectionOverlay, GMapOptions, GeoJSOptions, GeoJSPlot, 
    NumeralTickFormatter, PrintfTickFormatter)
from bokeh.resources import INLINE

gmap_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=13)

x_range = Range1d()
y_range = Range1d()

plot = GMapPlot(
        x_range=x_range, y_range=y_range,
        map_options=gmap_options,
        title = "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)

plot.add_tools(PanTool(), WheelZoomTool(), ResetTool())

xaxis = LinearAxis(axis_label="lat", major_tick_in=0, formatter=NumeralTickFormatter(format="0.000"))
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis(axis_label="lon", major_tick_in=0, formatter=PrintfTickFormatter(format="%.3f"))
plot.add_layout(yaxis, 'left')

doc = Document()
doc.add(plot)

if __name__ == "__main__":
    filename = "maps.html"
    with open(filename, "w") as f:
        f.write(file_html(doc, INLINE, "Maps Example"))
    print("Wrote %s" % filename)
    view(filename)
@bryevdv
Copy link
Member

bryevdv commented Sep 8, 2015

@brendancol could you take a look at this?

@birdsarah
Copy link
Member

As of 0.11.1, reset just appears to do nothing, rather than resetting to 0,0.

A fix may be related to #3783 (but may be not).

Here's updated code: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/2822.ipynb (note this plot is only rendering sometimes for me - probably related to #3737)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants