Skip to content

Commit

Permalink
dropped geocode_ prefix in arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
prusswan committed Jan 10, 2024
1 parent 31340d3 commit 781cfe2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions folium/plugins/geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class Geocoder(JSCSSMixin, MacroElement):
Choose from 'topleft', 'topright', 'bottomleft' or 'bottomright'.
add_marker: bool, default True
If True, adds a marker on the found location.
geocode_zoom: int, default 11, optional
zoom: int, default 11, optional
Set zoom level used for displaying the geocode result, note that this only has an effect when add_marker is set to False. Set this to None to preserve the current map zoom level.
geocode_provider: str, default 'nominatim'
provider: str, default 'nominatim'
Defaults to "nominatim", see https://github.com/perliedman/leaflet-control-geocoder/tree/2.4.0/src/geocoders for other built-in providers.
geocode_provider_options: dict, default {}
provider_options: dict, default {}
For use with specific providers that may require api keys or other parameters.
For all options see https://github.com/perliedman/leaflet-control-geocoder
Expand All @@ -39,17 +39,17 @@ class Geocoder(JSCSSMixin, MacroElement):
var geocoderOpts_{{ this.get_name() }} = {{ this.options|tojson }};
// note: geocoder name should start with lowercase
var geocoderName_{{ this.get_name() }} = geocoderOpts_{{ this.get_name() }}["geocodeProvider"];
var geocoderName_{{ this.get_name() }} = geocoderOpts_{{ this.get_name() }}["provider"];
var customGeocoder_{{ this.get_name() }} = L.Control.Geocoder[ geocoderName_{{ this.get_name() }} ](
geocoderOpts_{{ this.get_name() }}['geocodeProviderOptions']
geocoderOpts_{{ this.get_name() }}['providerOptions']
);
geocoderOpts_{{ this.get_name() }}["geocoder"] = customGeocoder_{{ this.get_name() }};
L.Control.geocoder(
geocoderOpts_{{ this.get_name() }}
).on('markgeocode', function(e) {
var zoom = geocoderOpts_{{ this.get_name() }}['geocodeZoom'] || {{ this._parent.get_name() }}.getZoom();
var zoom = geocoderOpts_{{ this.get_name() }}['zoom'] || {{ this._parent.get_name() }}.getZoom();
{{ this._parent.get_name() }}.setView(e.geocode.center, zoom);
}).addTo({{ this._parent.get_name() }});
Expand All @@ -75,9 +75,9 @@ def __init__(
collapsed: bool = False,
position: str = "topright",
add_marker: bool = True,
geocode_zoom: Optional[int] = 11,
geocode_provider: str = "nominatim",
geocode_provider_options: dict = {},
zoom: Optional[int] = 11,
provider: str = "nominatim",
provider_options: dict = {},
**kwargs
):
super().__init__()
Expand All @@ -86,8 +86,8 @@ def __init__(
collapsed=collapsed,
position=position,
default_mark_geocode=add_marker,
geocode_zoom=geocode_zoom,
geocode_provider=geocode_provider,
geocode_provider_options=geocode_provider_options,
zoom=zoom,
provider=provider,
provider_options=provider_options,
**kwargs
)

0 comments on commit 781cfe2

Please sign in to comment.