-
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
Allow GeoJSON to be used with Custom Pane #2028
Comments
Just as a motivation for this, the code below creates a map with a sidebyside layer.
Resulting in... You can see the map on the left has the marker but does not on the right. I'd like to be able to do this with polygons, not just markers. |
I did not try it yet myself, but I think this should "just work". The Could you try it and see what happens? |
Unfortunately I get an error:
throws the error: _geojson_layer = folium.GeoJson(geojson_data, pane='right', name='GeoJSON Example') TypeError: GeoJson.init() got an unexpected keyword argument 'pane'_ |
Strange, I cannot reproduce your error message.
Regardless of the exact message, it does not appear to be working as you want. |
Ah thank you for following up.
The marker is correctly in the left pane only, but the polygon is on both panes... |
Folium is just a thin python wrapper around the javascript Leaflet library (and contributed plugins.) We cannot do bug fixes or feature requests for the upstream packages. I did some digging, but this is a known issue with the underlying Leaflet plugin. You can override the underlying plugin source and make it point to: https://raw.githubusercontent.com/s22s/leaflet-side-by-side/refs/heads/feature/support-img-overlay-geojson/leaflet-side-by-side.min.js See the docs for examples: https://python-visualization.github.io/folium/latest/advanced_guide/customize_javascript_and_css.html. I did not test this myself, so maybe it will not work with GeoJson, but you could try it. If it works, let us know, and we can improve our documentation. |
Thank you, I will report back |
Is your feature request related to a problem? Please describe.
I can assign a folium marker to a custom pane as in the example below:
However, there is no "pane" argument for folium.GeoJson.
Could this please be added?
Describe the solution you'd like
The ability to add a specific GeoJSON to a custom pane.
Describe alternatives you've considered
I am not sure where to start.
The text was updated successfully, but these errors were encountered: