Skip to content
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

Leaflet Control [draft] #1662

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Conengmo
Copy link
Member

@Conengmo Conengmo commented Nov 23, 2022

Trying out an idea I had based on a number of issues I've encountered. Use the Leaflet Control class to put legends, images or other custom stuff on the map. That way they integrate better with other Leaflet features, such as full screen and potentially layer control.

Before this is ready I'll look at how this combines with layer control. And what the potential benefits are for other folium classes that are currently outside of Leaflet control.

Possibly related issues:
#450
#1344
#1079
#1167

Some lessons:

  • Nearly everything in Leaflet is meant to move with the map. So inheriting from anything related to L.Layer is not the way to go.
  • L.Control is static, but can't be switched in LayerControl.
  • Adding arbitrary content as a control is one use case, making arbitrary content switchable with layer control is a separate use case.

@Conengmo Conengmo changed the title Leaflet Control Leaflet Control [draft] Jan 4, 2023
@hansthen
Copy link
Collaborator

@Conengmo Would you mind if I continue this branch?

The feature in itself would be really useful. Also, from an architectural perspective, adding a Control base class would also be beneficial, especially for plugins with items that subclass L.Control. These now subclass directly from branca.MacroElement which is not the cleanest solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants