On Mar 13, 2017, at 05:46, Tim <[email protected]> wrote:
Thank you for your reply. I decided to change my approach and I'm running into a new problem.
With this code, I'm able to plot an rectangle with 4 points and 4 lines.However, it doesn't use Lat Lon inputs. How do I change my input coordinates to Lat Lon?
from bokeh.io import output_file, show
from bokeh.plotting import figure
from bokeh.tile_providers import STAMEN_TONER, STAMEN_TERRAIN, CARTODBPOSITRON
from bokeh.plotting import ColumnDataSource
from bokeh.models import HoverTool
from bokeh.models import WheelZoomTool, PanTool, SaveTool, ResetTool
source_lines = ColumnDataSource(
data = dict(
source_circles = ColumnDataSource(
data = dict(
lat = [20,26,20,26],
lon = [88,88,92,92],
size = [5,2,3,7],
width = ["a","b","c","d"]
hover = HoverTool(
bound = 200 # meters
fig = figure(tools = [hover],x_range=(-bound, bound),
fig.toolbar.active_scroll = WheelZoomTool()
fig.axis.visible = True
fig.segment(x0='lon0', y0='lat0', x1='lon1',
y1='lat1', color="#F4A582", line_width='width', source=source_lines)
fig.circle('lon','lat', fill_color='red', size = 'size', source=source_circles)
fig.axis.visible = True
output_file("Rectangle around Bangladesh.html")
On Sunday, 12 March 2017 22:11:44 UTC+1, Bryan Van de ven wrote:
The "out of frame" problem is due to some change on Google's end. However, this problem has recently been fixed in master and will be in the next release. It is also available in the latest dev builds.
The save button can only save what is on the HTML canvas currently which means it cannot work with GMaps, unfortunately (they render in a separate DOM element).
Regarding the other issue you mention, I think that was also recently fixed in master (there is a pile of GMap improvements and fixes going in the next release) but it's not possible to know for sure without code to run.
I think you will find GMap significantly improved when 0.12.5 is released. However, if "save" is a mandatory requirement for you, then I think for now your only option is the TileRenderer (e.g. Stamen) plots. If you have suggestions that would help with specifying coordinates, etc. please make feature requests on GitHub:
It's almost always better when feature development proceeds from concrete user use-cases so your input would be valuable.
> On Mar 11, 2017, at 17:39, Tim <[email protected]> wrote:
> Hello everyone,
> I'm new to Bokeh and I'm having some problems using it. I will try to describe my problems and purpose as complete as possible, but feel free to skip irrelevant parts of my post.
> Plot roads and bridges in Bangladesh on a map, to give insight in the vulnerability of these roads and bridges.
> Plot roads as lines in the map and use width and color as metrics to indicate certain vulnerability indicators
> Plot bridges as dots in the map and use size and color ~~
> At this point I'm exploring Bokeh's functionalities. I have made different maps with using GMapPlot and Stamen map.
> I found it difficult to work with coordinates in Stamen (I don't have much knowledge of JSTOR), so I decided to use GMapPlot, since it handles coordinates more easily.
> I started with plotting some random points in Bangladesh and that works
> I wanted to plot a square around bangladesh and this doesn't work.
> At this point I have no clue what the problem could be, because I don't get errors
> Problems at this point:
> • I want to plot 2 glyphs on the map (circles and lines), The points work, but the lines don't
> • If I add both lines and circles, the lines are not plotted
> • If I comment out the circles, the lines glyph appears and then disappears again.
> • The save button let's me download a file, but the picture shows nothing.
> • The map is plotted out of it's frame (both with using chrome and edge browsers
> Additional question:
> - Are there known disadvantages of using GMapPlot? Do you recommend me to use Stamen in combination with JSTOR?
> I'm looking forward to receiving some feedback.
> • Bokeh html file
> • Python code
> • Jupyter Notebook File
> • Below I also pasted the code I used
> Python code (Python 3 and working in Jupyter notebooks 4.3.1)
> from bokeh.io import output_file, show
> from bokeh.models import (
> GMapPlot, GMapOptions, ColumnDataSource, Circle, DataRange1d,
> PanTool, WheelZoomTool, BoxSelectTool, SaveTool, )
> from bokeh.models.glyphs import Segment
> map_options = GMapOptions(lat=24, lng=90, map_type="roadmap", zoom=7)
> plot = GMapPlot(
> x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options
> plot.title.text = "Bangladesh"
> plot.api_key = "AIzaSyD27PG4tV85tftwwxSn-Rl2RVSoFqjxtVw"
> # Load in Bangladesh Data
> source_lines = ColumnDataSource(
> data = dict(
> lon0=[88,88,92,92], #x
> lon1=[88,92,92,88], #x
> lat0=[20,26,20,20], #y
> lat1=[26,26,26,20], #y
> source_points = ColumnDataSource(
> lat = [20,26,20,26,23.81],
> lon = [88,88,92,92,90.4],
> size = [9,9,9,9,10],
> info = ["a","b","c","d","Dhaka"]
> # circle = Circle(x="lon", y="lat", size='size', fill_color="blue", fill_alpha=0.8, line_color=None)
> # plot.add_glyph(source_points, circle)
> lines = Segment(x0='lon0', y0='lat0', x1='lon1',
> y1='lat1', line_color="red", line_width=100)
> plot.add_glyph(source_lines, lines)
> plot.add_tools(PanTool(), WheelZoomTool(), SaveTool())
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/20416263-5221-4c3e-aab1-81e49681be3a%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.
> <gmap_plot.html><Test map-2-clean-v6.ipynb>
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/1242741e-1237-4171-83ab-478b8467c78c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.