Adding geojson properties to popup
See original GitHub issueI have the following code which uses this geojson file as input.
import folium
markers_geojson='volcanoes_json.geojson'
map=folium.Map(location=[0,0],zoom_start=6,tiles='Mapbox bright')
map.add_child(folium.GeoJson(data=open(markers_geojson),name='Volcano').add_child(folium.Popup("A plain pop up string")))
map.save(outfile='test5.html')
As you see the code is simply displaying a static string. Is there a way to put marker properties values contained in the json file in the popup method?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Displaying properties of GeoJSON in popup on Leaflet?
This is my simple GeoJSON with Leaflet map. I want to display properties as popup but I don't know why it is empty....
Read more >Leaflet Popup with additional information from GeoJSON
Assuming the service returns data with similar properties as the polygon, you can indeed add them to one and the same layer.
Read more >Leaflet Map with GeoJSON popups
getJSON("map.geojson", function(data) { function onEachFeature(feature, layer) { layer.bindPopup("Name: " + feature.properties.name + "<br>" + "Population: ...
Read more >Using GeoJSON with Leaflet
GeoJSON objects are added to the map through a GeoJSON layer. To create it and add it to a map, we can use...
Read more >Leaflet Examples
Example 6: Adding points from a geojson file with popups - Change popup values (this is inside the GeoJSON file). Example 7: Adding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot for your help.
FeatureGroup worked well. The map now has popups and a layer control. Here is the code for future reference:
Any reading through these, be careful about calling your map “map”. map is a built-in function in Python and you would overwrite the name. Use “m”, like in the folium docs to avoid confusion. 😉 https://docs.python.org/3/library/functions.html#map