我只能设置缩放,但我需要有一个非常具体的位置,所以我可以将它覆盖在另一个地块上。 我如何从下面指定的限制中获取视图?现在我只能设置一个难以覆盖在另一个地块上的缩放。
from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, GMapOptions
from bokeh.plotting import gmap
output_file("gmap.html")
lat_lims = (42.418574999999997, 42.420059000000002)
lon_lims = (-70.907111, -70.904135999999994)
map_options = GMapOptions(lat=np.mean(lat_lims), lng=np.mean(lon_lims), map_type="satellite", zoom=18)
# For GMaps to function, Google requires you obtain and enable an API key:
#
# https://developers.google.com/maps/documentation/javascript/get-api-key
#
# Replace the value below with your personal API key:
p = gmap(googlemaps_api_key, map_options)
show(p)
答案 0 :(得分:0)
如果您运行的是Bokeh服务器应用程序,那么边界可能会以某种方式返回到Python,但我担心它不可能存在于独立的Bokeh文档(即HTML文件)中。我们受到使用Google maps API的限制,只有JavaScript代码在浏览器中执行后才能使用您要求的边界。 Google API不接受任意用户提供的边界,它只接受中心/缩放或建议的区域。真实边界仅由Google API计算并返回(到浏览器),并且从未在Python中计算或提供。
您可以查看可用的非Google TileProvider plots。与GMap图不同,您自己可以设置地图边界。