为什么多边形颜色不变?地黄叶

2024-09-30 14:19:21 发布

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

我在alt = gpd.read_file('/content/altura-bog-localidad.geojson')中放置的一个对开本贴图多边形中设置,但我的代码没有反映任何颜色变化

我找不到发生了什么事

ubicacion1 = 4.56,-74.06 #Latid y longitu promedio de la ciudad de bogotá
zoom1 = 10.48
color=['blue','orange','yellow','cyan','magenta','turquoise','coral','gold','olivedrab','pink','violet','indigo','peru','grey','lime','moccasin','peru','black','darkgreen']

#Función del mapa de las localidades
def loc(alt,ubicacion, zoom1,tiles,color):
  mapa = folium.Map(ubicacion, zoom_start=zoom1, tiles=(tiles), width = "%80", height = "%80", control_scale=True)
  for i in alt.index:
    color=alt.iloc[i,-1]
    a=alt.iloc[i,1]
    b=alt.iloc[i,-3].astype(str)
    AN = folium.GeoJson(data=alt.iloc[i,-2], style_function=lambda feature: {
        'fillColor': color,
        'color' : color,
        'weight' : 2,
        'fillOpacity' : 0.2,
        'lineOpacity' : 0.5
        }
        )
    AN.add_child(folium.Popup(a+'  Altura: '+b+' msnm'))
    AN.add_to(mapa)
  return mapa

loc(alt,ubicacion1, zoom1,'OpenStreetMap', color)

Tags: anadddealtloccolortilesperu