Skip to content

Geocoder plugin breaks due to renamed CSS file in leaflet-control-geocoder 3.0.0 #2058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
g-fabiani opened this issue Dec 17, 2024 · 1 comment

Comments

@g-fabiani
Copy link

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')
  1. Run the code above.
  2. Open the generated map_with_geocoder.html file in a browser.
  3. 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 file Control.Geocoder.css was renamed to leaflet-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

@g-fabiani
Copy link
Author

The issue is solved by version 3.0.1 of the leaflet-control-geocoder library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant