简体   繁体   English

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

[英]Change the color of Marker Symbol in Google maps - Python

I am trying to plot a set of lat longs in python using Google API. 我正在尝试使用Google API在python中绘制一组经纬度。 I have used the gmaps package. 我已经使用了gmaps包。 I have used the following code and created the map. 我已使用以下代码并创建了地图。

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

在此处输入图片说明

Now I want to do the following options 现在我想做以下选择

  1. Change the color of the marker symbol which is red currently 更改当前为红色的标记符号的颜色
  2. Reduce / Increase the size of the marker symbol 缩小/增加标记符号的大小

Is it possible to do both of these in gmaps? 是否可以在gmaps中同时做这两项? Can anybody help me in doing this? 有人可以帮我吗? Is there any other packages which is available in python, that allows me to do this? 还有其他可用的python软件包,允许我执行此操作吗?

Thanks 谢谢

Markers and symbols : 标记和符号

Markers are currently limited to the Google maps style drop icon. 标记目前仅限于Google地图样式放置图标。 If you need to draw more complex shape on maps, use the symbol_layer function. 如果需要在地图上绘制更复杂的形状,请使用symbol_layer函数。 Symbols represent each latitude, longitude pair with a circle whose colour and size you can customize. 符号代表每个纬度,经度对,并带有一个可以自定义颜色和大小的圆圈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM