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 Coordinate Axes #2940

Closed
avanetten opened this issue Oct 2, 2015 · 3 comments
Closed

GMapPlot Coordinate Axes #2940

avanetten opened this issue Oct 2, 2015 · 3 comments

Comments

@avanetten
Copy link

@avanetten avanetten commented Oct 2, 2015

GmapPlot no longer displays lat/lon coordinates in useful formats. It's hard to quantify this due to issue #2939, but it also appears that points are appearing ~20 pixels to the left of where they ought to be projected on a map. The code below is the exact same as from issue #2822.

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)
@birdsarah
Copy link
Member

@birdsarah birdsarah commented Nov 5, 2015

The axes being displayed are those of the web mercator projection that google maps uses. Previously GMap was not correctly transforming lat lon points into web mercator which was a problem.

Definitely agree that a lat-lon transformed axes would be useful new feature.

You seem to be having a separate problem about a 20px offset. Can you elaborate more on this, maybe on a separate issue, so we can treat it seperately from the lat-lon mapped axis feature request.

@birdsarah
Copy link
Member

@birdsarah birdsarah commented Nov 5, 2015

@brendancol I've forgotten did your tile renderer work result in a mapped axis being available?

@bryevdv bryevdv added this to the 0.12.5 milestone Jan 9, 2017
@bryevdv bryevdv added type: task and removed type: discussion labels Jan 9, 2017
@bryevdv
Copy link
Member

@bryevdv bryevdv commented Jan 9, 2017

I think we can come up with a tick formatter that will display good labels without too much fuss.

@bryevdv bryevdv mentioned this issue Mar 19, 2017
3 of 3 tasks complete
@bryevdv bryevdv changed the title GMapPlot Coordinates GMapPlot Coordinate Axes Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.