Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 段图示符GMapPlot覆盖问题-bokeh 0.10.0_Python_Google Maps_Overlay_Bokeh - Fatal编程技术网

Python 段图示符GMapPlot覆盖问题-bokeh 0.10.0

Python 段图示符GMapPlot覆盖问题-bokeh 0.10.0,python,google-maps,overlay,bokeh,Python,Google Maps,Overlay,Bokeh,我在几个月前写的一个脚本中遇到了一个问题,该脚本用于成功地将片段覆盖到GMapPlots上。该脚本从那以后就没有更改过,并且之前已经过验证(我相信是在0.9.3中) 该示例过于冗长,无法包含在这里,但可以使用bokeh/examples/glyphs/maps.py示例来说明我的问题。将该脚本修改为使用GMapPlot无法覆盖分段图示符,但对其余部分效果良好。我做错什么了吗 from __future__ import print_function from bokeh.browserlib

我在几个月前写的一个脚本中遇到了一个问题,该脚本用于成功地将片段覆盖到GMapPlots上。该脚本从那以后就没有更改过,并且之前已经过验证(我相信是在0.9.3中)

该示例过于冗长,无法包含在这里,但可以使用bokeh/examples/glyphs/maps.py示例来说明我的问题。将该脚本修改为使用GMapPlot无法覆盖分段图示符,但对其余部分效果良好。我做错什么了吗

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, DataRange1d, ColumnDataSource,
    PanTool, WheelZoomTool, BoxSelectTool,
    BoxSelectionOverlay, GMapOptions, Segment, Ray)
from bokeh.resources import INLINE

# JSON style string taken from: https://snazzymaps.com/style/1/pale-dawn
map_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=13, styles="""
[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}]
""")

xdr = DataRange1d()
ydr = DataRange1d()
现在,如果我调用下面的绘图并继续下面的脚本,它将生成一个带有三个圆和连接它们的线段的绘图:

# ADDING SEGMENTS TO THIS PLOT WORKS
plot = Plot(
    title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
    h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None) 
但是,如果使用以下GMapPlot,则不会显示线段图示符,仅显示圆图示符:

# ADDING SEGMENTS TO THIS PLOT DOES NOT WORK
plot = GMapPlot(x_range=xdr, y_range=ydr, map_options=map_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']
    )
)

segdata = ColumnDataSource(
    data=dict(
        lonend=[-97.7390,-97.7405],
        lonstart=[-97.7394,-97.7390],
        latend=[30.2855,30.2869],
        latstart=[30.2861,30.2855]
    )
)

segment = Segment(x0='lonstart',y0='latstart',x1='lonend',y1='latend',line_color="firebrick",line_width=5)
plot.add_glyph(segdata, segment)

circle = Circle(x="lon", y="lat", size=10, fill_color="fill", line_color="black")
plot.add_glyph(source, circle)

pan = PanTool()
wheel_zoom = WheelZoomTool()
box_select = BoxSelectTool()

plot.add_tools(pan, wheel_zoom, box_select)
overlay = BoxSelectionOverlay(tool=box_select)
plot.add_layout(overlay)

doc = Document()
doc.add(plot)

if __name__ == "__main__":
    filename = "maps.html"
    with open(filename, "w") as f:
        f.write(file_html(doc, INLINE, "Google Maps Example"))
    print("Wrote %s" % filename)
    view(filename)


你有没有想过这一点?因为我也看到了同样的问题