-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Folium map not rendering when Marker 'popup' specified? #726
Copy link
Copy link
Closed
Description
Apologies, in advance, if this not the most appropriate place for this question (as this might be a Jupyter Notebook issue)!
Issue
I cannot get Folium to render a map when the 'popup' parameter for Marker objects are specified via list indexing (where the list contains strings). What's confusing is that it works fine if the Marker 'popup' is a static string!
Example: Working code
This code works (i.e., a viewable map is rendered) in a Jupyter notebook cell:
# Imports dependency used to drop markers onto a map
import folium
# Isolating "northing" and "easting" information with labels for each point
locationlist = df_nearme[["Latitude","Longitude"]].values.tolist()
labels = df_nearme["Cafe Name"].values.tolist()
# Create map and drop points onto it
m = folium.Map(location=[lat_home, long_home], zoom_start=14)
for point in range(len(locationlist)):
folium.Marker(locationlist[point]).add_to(m)
mSo does this code:
# Imports dependency used to drop markers onto a map
import folium
# Isolating "northing" and "easting" information with labels for each point
locationlist = df_nearme[["Latitude","Longitude"]].values.tolist()
labels = df_nearme["Cafe Name"].values.tolist()
# Create map and drop points onto it
m = folium.Map(location=[lat_home, long_home], zoom_start=14)
for point in range(len(locationlist)):
folium.Marker(locationlist[point], popup='abc123').add_to(m)
mExample: Not working code
BUT this code does not render a viewable map (no error is thrown, but I just get a blank, white box):
# Imports dependency used to drop markers onto a map
import folium
# Isolating "northing" and "easting" information with labels for each point
locationlist = df_nearme[["Latitude","Longitude"]].values.tolist()
labels = df_nearme["Cafe Name"].values.tolist()
# Create map and drop points onto it
m = folium.Map(location=[lat_home, long_home], zoom_start=14)
for point in range(len(locationlist)):
folium.Marker(locationlist[point], popup=labels[point]).add_to(m)
mAs I mentioned before, I suspect this has something to do with Jupyter Notebook, but I'm not entirely sure and figured I'd ask to see if anyone else has run into this issue.
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels