diff --git a/folium/features.py b/folium/features.py index 437e92664..4d01492f5 100644 --- a/folium/features.py +++ b/folium/features.py @@ -422,10 +422,10 @@ class GeoJson(Layer): {% if this.style %} style: {{ this.get_name() }}_styler, {%- endif %} - }); + }).addTo({{ this._parent.get_name() }}); + function {{ this.get_name() }}_add (data) { - {{ this.get_name() }}.addData(data) - .addTo({{ this._parent.get_name() }}); + {{ this.get_name() }}.addData(data); } {%- if this.embed %} {{ this.get_name() }}_add({{ this.data|tojson }});