folium icon indicating copy to clipboard operation
folium copied to clipboard

Read GeoJSON style from file as default

Open ocefpaf opened this issue 11 years ago • 7 comments

We have a template (geojson_style.js) for styling the GeoJSON object.

function {{ style }}(feature) {
    return {
        {%- if quantize_fill %}
        fillColor: {{ quantize_fill }},
        {%- else %}
        fillColor: '{{ fill_color }}',
        {%- endif %}
        weight: {{ line_weight }},
        opacity: {{ line_opacity }},
        color: '{{ line_color }}',
        fillOpacity: {{ fill_opacity }}
    };
}

The template is filled here and that usually happens with the default values. But if the GeoJSON file has properties defined a simple function style_1(feature) {return feature.properties;} would suffice and, in same cases, that is the expected behavior.

I would like to discuss here the possibility of making "reading from properties" the default behavior instead of the default values we have and leave the kwargs as an override option.

ocefpaf avatar Aug 21 '15 01:08 ocefpaf

It won't be default but a function for the simple-spec will be available.

See #266.

ocefpaf avatar Dec 03 '15 20:12 ocefpaf

We should also implement a way to add onEachFeature.

(See https://github.com/python-visualization/folium/issues/6#issuecomment-161994518)

ocefpaf avatar Dec 04 '15 15:12 ocefpaf

It would be great to have popup capability added to geojson / choropleth layers. Eager to see onEachFeature added. Thanks guys!

baobobs avatar Dec 15 '15 18:12 baobobs

Closing this as we never found a champion to write the simple style.

ocefpaf avatar Sep 23 '16 14:09 ocefpaf

@ocefpaf Sorry I just followed the rabbit hole of issues to get to this point. Does this mean there is no implementation for popups on geojson layers?

jgoad avatar Nov 29 '16 17:11 jgoad

@ocefpaf Sorry I just followed the rabbit hole of issues to get to this point. Does this mean there is no implementation for popups on geojson layers?

I plan to work on this soon, unless someone beats me to it.

ocefpaf avatar Feb 03 '17 11:02 ocefpaf

Any news on this issue?

jzf2101 avatar Aug 01 '17 23:08 jzf2101