Change GeoJSON style_callback post-instantiation?
See original GitHub issueWhen I add a GeoJSON layer like this:
m = Map(center=[38.8976, -77.0365], zoom=11)
gj = GeoJSON(data=open("my.geojson").read())
m.add_layer(gj)
I can change its style
attribute later and the browser will apply the change:
gj.style = {"color": "red"} # changes color from default to red
It would be very useful if the same would happen when “changing” the style_callback
parameter" dynamically at any time later (and not only when instantiating the object) like this (setting it to a constant value only for illustration):
gj.style_callback = lambda feature: {"color": "green"}
But this has no effect now. I see that style_callback
is not listed in gj.keys
which is likely one part of the reason… I’m trying to understand if this would be possible or not.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
Leaflet Geojson Styling - GIS Stack Exchange
First try drawing the layer without specifying a style, does it draw with the default styling ? This will help determine if the...
Read more >Callback on clicking a layer in Open Layer - Stack Overflow
I have an Open Map that I created, with a vector layer with several polygons. How can I detect a user click on...
Read more >GeoJSONLayer | ArcGIS Maps SDK for JavaScript 4.25
The GeoJSONLayer class is used to create a layer based on GeoJSON. GeoJSON is a format for encoding a variety of geographic data...
Read more >Documentation - a JavaScript library for interactive maps
Changes styles of GeoJSON vector layers with the given style function. ▷ Methods inherited from FeatureGroup ...
Read more >Managing Asynchrony - Understanding Ember.js
getJSON('/posts/1', function(json) { // set all of the JSON properties on the model ... the computation in a callback when the underlying property...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@martinRenou - I would like to work on this for JupyterCon sprint. Please assign this to me.
load_data_style
?