-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix __geo_interface__ styling #1935
Conversation
@@ -237,6 +237,23 @@ colormap.add_to(m) | |||
m | |||
``` | |||
|
|||
> | |||
> **Caveat** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Conengmo do you have any suggestion to make this more prominent, like a red warning sign?
Also, I'd like to link the geopandas_and_geo_interface.html#Adding-style
to the GeoPandas object suggestion below but I have no idea how to do that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is clear enough with the specified Caveat. It is a very tricky bug, but I also imagine it is not a very common software pattern to create style functions in a loop. (It took some ten years for this to be discovered.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, it is :-/
I recall (now b/c I forgot ;-) adding the geopandas alternative to escape that. We have a few issues reported and question on SO. Hopefully we can point folks to this paragraph instead from now on.
@@ -643,6 +643,10 @@ class GeoJson(Layer): | |||
.done({{ this.get_name() }}_add); | |||
{%- endif %} | |||
|
|||
{%- if not this.style %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked all the docs/notebooks we have and none broke. If the user specifies a style_function
, whatever is in the geojson will be ignored but, if nothing is specified and the geojson has style info, that will be used instead. I guess this is the best I could come up with but I'm open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required to fix this bug? It seems like a new feature. If so perhaps it is better to separate this into a new PR.
Also, what happens if a Feature in the GeoJson does not have a style
property? Will leaflet handle this correctly?
@@ -643,6 +643,10 @@ class GeoJson(Layer): | |||
.done({{ this.get_name() }}_add); | |||
{%- endif %} | |||
|
|||
{%- if not this.style %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required to fix this bug? It seems like a new feature. If so perhaps it is better to separate this into a new PR.
Also, what happens if a Feature in the GeoJson does not have a style
property? Will leaflet handle this correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes required for the issue at hand? If not perhaps it is cleaner to open a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are required to fix the styling for the geopandas case. This fixes a regression introduced during the GeoJson refactoring. I prefer to keep them both in the same PR b/c they are tied together by the same issue, even though they have different origins.
Closes #1932.
__geo_interface__
object) styling regression.style_function
in a loop.