In [1]:
from bokeh.io import output_file
from bokeh.plotting import figure, show
from bokeh.models.glyphs import ImageURL
from bokeh.models import GMapPlot, GMapOptions, Circle, PanTool, WheelZoomTool, BoxSelectTool
from bokeh.models import Range1d, ColumnDataSource
from helpercode import generateTimeData, generateLocations
from scipy import stats as spst
In [2]:
api_key='lulz not falling for that one'
samples=1000
radius=10 #km
center={'lat':57.7090,'lon':11.9745} #centerpoint
In [3]:
#fetch potato booking data. startdate, enddate, length of booking.
dataTimeDict=generateTimeData(spst.genpareto, 1.,{'loc':1800.,'scale':3.}, samples)
In [4]:
dataLocationDict=generateLocations(samples,radius,center)
#Simple sanity check
print((dataLocationDict['lat'][0],dataLocationDict['lon'][0]))
In [5]:
#Starting point is the geodata example from Bokeh:
#https://bokeh.pydata.org/en/latest/docs/user_guide/geo.html
map_options = GMapOptions(lat=57.709041, lng=11.974550,
map_type="roadmap", zoom=11)
plot = GMapPlot(x_range=Range1d(), y_range=Range1d(),
map_options=map_options)
plot.title.text = "GBG radius {} km".format(radius)
plot.api_key = api_key
source = ColumnDataSource(
data=dataLocationDict
)
circle = Circle(x="lon", y="lat", size=7, fill_color="Coral", fill_alpha=0.8, line_color=None)
plot.add_glyph(source, circle)
plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())
output_file("gmap_plot.html")
show(plot)
In [ ]: