I created a choropleth state map with counties using a geojson. I'm curious if it's possible to create a pop up with data located within a CSV when a polygon (county) is clicked on. Can anyone point me in the right direction if such documentation exists?
Asked
Active
Viewed 270 times
0
-
I would leverage Pandas' [read_csv](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) and [to_html](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_html.html) – Bob Haffner Mar 04 '19 at 13:26
-
If you were to put your data inside the geojson dictionary you can use the [`GeoJsonTooltip` class](https://python-visualization.github.io/folium/modules.html#folium.features.GeoJsonTooltip). – Conengmo Mar 06 '19 at 15:55
-
@conengmo Yes! This is exactly what I’m looking for. Now I need to figure out how to append the geojson file with the information I have in the csv. – prime90 Mar 08 '19 at 00:08
-
I think it's the other way around, you put the data from your csv in your geojson. To each geometry add a field that contains the data (from the csv) you want to display in the popup for that geometry. – Conengmo Mar 08 '19 at 10:07
-
@Conengmo I did exactly that. However, I'm having problems applying this to a folium.Choropleth layer. I created a new question if you wouldn't mind having a look. https://stackoverflow.com/questions/55088688/how-do-you-add-geojsontooltip-to-folium-choropleth-class-in-folium – prime90 Mar 10 '19 at 14:37