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)
m
So 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)
m
Example: 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)
m
As 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!
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:
So does this code:
Example: Not working code
BUT this code does not render a viewable map (no error is thrown, but I just get a blank, white box):
As 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!