folium

TypeError received while trying to create Folium Colorline

TypeError received while trying to create Folium Colorline Question: I’m trying to create ColorLine for set of latitude and longitude coordinates. Code for the same is below, map_object = folium.Map(location=[15.235683, 75.167737], zoom_control=True, zoom_start = 10, control_scale=True) coordinates = [(15.564746,74.819551), (15.392602,75.173812),(15.392602,75.173812),(15.413797,74.735791)] color=[‘red’,’green’,’blue’] # should be of length len(coordinates) -1 line = features.ColorLine(coordinates,colors = color , weight= …

Total answers: 1

Streamlit Folium drawing map as if all values are null

Streamlit Folium drawing map as if all values are null Question: I am attempting to embed a Folium choropleth into a Streamlit webapp. When doing so, it is drawing the map with all countries as null for their value. This contains two select boxes that are for filtering indicators and year/year span. I have attempted …

Total answers: 1

Choropleth map with plotly

Choropleth map with plotly Question: I’m trying to make a choropleth map with folium and with plotly in python. The data is from CBS: https://www.cbs.nl/nl-nl/onze-diensten/open-data/statline-als-open-data/cartografie. The folium choropleth works, but the plotly choropleth doesn’t. The legend is showing, but the map is not. What am I doing wrong? #Make choropleth map with folium and with …

Total answers: 1

Folium initial map coordinates location not working

Folium initial map coordinates location not working Question: I’m using folium to plot some coordinates and every time I run the code it opens the map at some default coordinates instead of the ones I’ve defined. I tried: import folium import pandas as pd # includes only an example route, dict contains N keys with …

Total answers: 1

Python – jinja2 template picks up only the first record from the data

Python – jinja2 template picks up only the first record from the data Question: I would like to make the on-click feature with a circle coming up when clicking on the marker. So far I’ve developed the class which includes relevant elements as shown in the code below: df = pd.read_csv("survey.csv") class Circle(MacroElement): def __init__(self): …

Total answers: 1

Python folium – Markercluster not iterable with GroupedLayerControl

Python folium – Markercluster not iterable with GroupedLayerControl Question: I would like to group my 2 marker cluster layers, where one is reliant on the other by providing a separate styling. Hence the second one is set as control=False. Nevertheless, I want to have it disappear when the first one is switched off. Along with …

Total answers: 2

Add a Clickevent Function to multiple Folium Markers with Python

Add a Clickevent Function to multiple Folium Markers with Python Question: I have an html file that has been generated with folium, within are multiple folium markers representing a range of different locations. With python I want to go through the html file and add a click event function to each marker so that on …

Total answers: 1

Python folium problem with editing draw plugin

Python folium problem with editing draw plugin Question: I would like to make some edits to the Python Folium.draw plugin. I have the code from the following link: https://github.com/python-visualization/folium/blob/main/folium/plugins/draw.py After applying it to my code I have an error: if self.export: NameError: name ‘self’ is not defined def __init__( self, export=False, filename="data.geojson", position="topleft", show_geometry_on_click=True, draw_options=None, …

Total answers: 1

Python folium – ValueError: Location values cannot contain NANs

Python folium – ValueError: Location values cannot contain NANs Question: I have a problem. After fetching my .csv file in Python I keep getting the following error: ValueError: Location values cannot contain NANs. My code looks like this: df = pd.read_csv("surveyed.csv") fc=folium.FeatureGroup(name="Tbs",overlay=True) cf_survey_cluster = MarkerCluster(name="Tbs").add_to(map) for i,row in df.iterrows(): city = df.at[i,’City’] address = df.at[i,’Address’] …

Total answers: 1