【发布时间】:2020-06-10 20:54:57
【问题描述】:
以下代码(其中 testdata.json 为 https://pastebin.com/tCZQGMsK)将生成带有补丁的图形,但是当我尝试在 gmap 上制作完全相同的补丁时,补丁不会显示出来。
import geopandas as gpd
import json
from bokeh.models import GeoJSONDataSource, GMapOptions, LinearColorMapper
from bokeh.io import output_notebook, show, output_file
from bokeh.plotting import gmap, figure
file = gpd.read_file("testdata.json")
j = json.loads(file.to_json())
data = json.dumps(j)
data_source = GeoJSONDataSource(geojson = data)
output_notebook()
map_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=11)
#this produces a figure
fig = figure()
fig.patches('xs','ys', source = data_source,
line_color = 'black', line_width = 0.25, fill_alpha = 1)
#there are no patches on this
plot = gmap("i keep posting this with my api key...", map_options, title = "test", tools="hover")
plot.patches('xs','ys', source = data_source,
line_color = 'black', line_width = 0.25, fill_alpha = 1)
show(plot)
output_file("gmap.html")
【问题讨论】:
标签: python gis bokeh geopandas