Read GeoJSON style from file as default
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.
It won't be default but a function for the simple-spec will be available.
See #266.
We should also implement a way to add onEachFeature.
(See https://github.com/python-visualization/folium/issues/6#issuecomment-161994518)
It would be great to have popup capability added to geojson / choropleth layers. Eager to see onEachFeature added. Thanks guys!
Closing this as we never found a champion to write the simple style.
@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?
@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.
Any news on this issue?