在Google地图Python中更改标记符号的颜色

2024-04-28 19:34:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用googleapi在python中绘制一组lat long。我用过gmaps软件包。我使用了以下代码并创建了地图。在

starbucks_df = starbucks_df[['ref_lat', 'ref_long']]
kfc_df = kfc_df[['ref_lat', 'ref_long']]

starbucks_layer = gmaps.symbol_layer(
    starbucks_df, fill_color="red",
    stroke_color="red", scale=5
)

kfc_layer = gmaps.symbol_layer(
    kfc_df, fill_color="black",
    stroke_color="black", scale=2
)


plant_locations = tuples_all_calls
info_box_template = """
<dl>
<dt>x</dt><dd>{x}</dd>
<dt>y</dt><dd>{y}</dd>
</dl>
"""
plant_info = [info_box_template.format(**plant) for plant in list1]

marker_layer = gmaps.marker_layer(plant_locations, info_box_content=plant_info, display_info_box=False)

fig = gmaps.figure()
fig.add_layer(starbucks_layer)
fig.add_layer(kfc_layer)
fig.add_layer(marker_layer)
fig

enter image description here

现在我想做以下选择

  1. 更改当前为红色的标记符号的颜色
  2. 减小/增大标记符号的大小

有没有可能在gmap中同时实现这两个功能?有人能帮我吗?在python中还有其他的包可以让我这样做吗?在

谢谢


Tags: infoboxreflayerdfdtfigdd
1条回答
网友
1楼 · 发布于 2024-04-28 19:34:05

Markers and symbols

Markers are currently limited to the Google maps style drop icon. If you need to draw more complex shape on maps, use the symbol_layer function. Symbols represent each latitude, longitude pair with a circle whose colour and size you can customize.

相关问题 更多 >