Description
Describe the bug
When using the Geocoder plugin, the plugin's CSS file fails to load due to a name change in the leaflet-control-geocoder
library from version 3.0.0
.
Folium still references the outdated file at https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css, but in version 3.3.0
the file has been renamed to leaflet-control-geocoder.css
. This results in a 404 error and the Geocoder widget is displayed incorrectly (missing styles).
To Reproduce
import folium
import folium.plugins
m = folium.Map()
folium.plugins.Geocoder().add_to(m)
m.save('map_with_geocoder.html')
- Run the code above.
- Open the generated
map_with_geocoder.html
file in a browser. - The geocoder widget is displayed incorrectly and the geocoder stylesheet is missing.
Expected behavior
The correct CSS file (leaflet-control-geocoder.css
) should be loaded, and the Geocoder widget should display with the expected styles.
Environment (please complete the following information):
- Browser firefox (133.0.3), chrome (131.0.6778.139)
- html files
- Python version 3.10.15
- folium version 0.16.0
- branca version 0.7.1
Additional context
The issue originates from the leaflet-control-geocoder library.
- In version
3.0.0
, the CSS fileControl.Geocoder.css
was renamed toleaflet-control.geocoder.css
. - Folium still references the old file name
Possible solutions
Update default_css
in the Geocoder
class to reference https://unpkg.com/leaflet-control-geocoder/dist/leaflet-control-geocoder.css