Эти примеры работают для меня.Замените map.shp своим именем файла.Работает с Bokeh v1.0.4.Выполнить с: python map.py
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
import geopandas as gp
import shapely
sf = gp.read_file('map.shp')
x, y = [], []
[(x.append(list(polygon.exterior.coords.xy[0])), y.append(list(polygon.exterior.coords.xy[1]))) for polygon in sf['geometry'] if type(polygon.boundary) == shapely.geometry.linestring.LineString ]
p = figure(title = "A map from Shapefile", plot_width = 800)
p.patches('x', 'y', source = ColumnDataSource(dict(x = x, y = y)), line_color = "white", line_width = 0.5)
show(p)
или
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
import geopandas as gp
def getPolyCoords(row, geom, coord_type):
if coord_type == 'x':
return list(row[geom].exterior.coords.xy[0])
elif coord_type == 'y':
return list(row[geom].exterior.coords.xy[1])
gdf = gp.GeoDataFrame.from_file('map.shp')
gdf['x'] = gdf.apply(getPolyCoords, geom = 'geometry', coord_type = 'x', axis = 1)
gdf['y'] = gdf.apply(getPolyCoords, geom = 'geometry', coord_type = 'y', axis = 1)
p_df = gdf.drop('geometry', axis = 1).copy()
p = figure(title = "A map from Shapefile", plot_width = 800)
p.patches('x', 'y', source = ColumnDataSource(p_df), line_color = "white", line_width = 0.5)
show(p)