求助:Folium.CircleMarker无法正常显示,地图仅加载无标记
Hey everyone, I’ve been stuck on this issue for 10 straight days—my Folium map of New Mexico displays without any problems, but the circle markers for each county just won’t appear, and I can’t pin down why.
What I’m Trying to Build
My end goal is to create a map of New Mexico’s counties that I can later layer with demographic data (like per capita income, household income, and other population stats) to help plan future school locations. I’m pulling latitude and longitude data from a CSV file, which I’ve combined with additional information scraped from Wikipedia.
My Code
First, here’s how I initialize the base map:
# Create map of New Mexico using latitude and longitude values map_NM = folium.Map(location=[latitude, longitude], zoom_start=7) map_NM
Then, the code I’m using to add county markers:
for lat, lng, County in zip(df_NewMex['Lat'], df_NewMex['Long'], df_NewMex['County']): label = '{}'.format(County) label = folium.Popup(label, parse_html=True) folium.CircleMarker( [lat, lng], radius=5, popup=label, color='blue', fill=True, fill_color='#3186cc', fill_opacity=0.7, parse_html=False ).add_to(map_NM) map_NM
Additional Details
I’ve included a screenshot of my CSV data file for reference:
I’ve double-checked that the CSV has valid lat/lng values and that the dataframe columns are correctly named, but I’m still missing something. Any ideas what could be causing the markers not to show up?
内容的提问来源于stack exchange,提问作者philmstudy

