Skip to content

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

Closed
@g-fabiani

Description

@g-fabiani

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions