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

Comments

@avanetten

avanetten commented Sep 8, 2015

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

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Sep 8, 2015

Member

@brendancol could you take a look at this?

Member

bryevdv commented Sep 8, 2015

@brendancol could you take a look at this?

@birdsarah

This comment has been minimized.

Show comment
Hide comment
@birdsarah

birdsarah Feb 10, 2016

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)

Member

birdsarah commented Feb 10, 2016

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)

@bryevdv bryevdv modified the milestones: 0.12.5, short-term Jan 9, 2017

@bryevdv bryevdv referenced this issue Jan 24, 2017

Merged

Fix several GMap issues #5693

1 of 1 task complete

@bryevdv bryevdv closed this in #5693 Jan 26, 2017

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