Skip to content

Instantly share code, notes, and snippets.

@nmolivo
Created March 17, 2018 18:51
Show Gist options
  • Save nmolivo/e3b38e6439e6afb66b07ddf945c9813a to your computer and use it in GitHub Desktop.
Save nmolivo/e3b38e6439e6afb66b07ddf945c9813a to your computer and use it in GitHub Desktop.
bokeh-valenbisi-map
from bokeh.io import output_file, show
from bokeh.models import (
GMapPlot, GMapOptions, ColumnDataSource, Circle, Range1d, PanTool, WheelZoomTool, BoxSelectTool, HoverTool,
)
from bokeh.plotting import figure
map_options = GMapOptions(lat=39.4699, lng=-0.3763, map_type="roadmap", zoom=13)
plot = GMapPlot(x_range=Range1d(), y_range=Range1d(), map_options=map_options)
plot.title.text = "Valenbisi Stations"
plot.api_key = "REPLACE_W_YOUR_OWN_API_KEY"
source = ColumnDataSource(
data=dict(
lat=stations['Long'].tolist(),
lon=stations['Lat'].tolist(),
)
)
source2 = ColumnDataSource(data=dict(xx=[-0.4113992, -0.3814647, -0.378187],
yy=[39.4697661, 39.4743981, 39.4791963],
))
#Plaza Ayuntamiento @39.4697661,-0.4113992
#Church of San Juan del Hospital @39.4743981,-0.3814647
#Torres de los Serranos @39.4791963,-0.378187
circle = Circle(x="lon", y="lat", size=5, fill_color="blue", fill_alpha=0.8, line_color=None)
plot.add_glyph(source, circle)
circle2 = Circle(x = 'xx', y = 'yy', size = 10, fill_color = 'red', fill_alpha = .8, line_color = None)
plot.add_glyph(source2, circle2)
plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())
output_file("gmap_plot.html")
show(plot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment