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

Make it possible for a marker to link to another marker #1563

Open
augusto-herrmann opened this issue Jan 15, 2022 · 2 comments
Open

Make it possible for a marker to link to another marker #1563

augusto-herrmann opened this issue Jan 15, 2022 · 2 comments
Labels
enhancement Feature request or idea about how to make folium better

Comments

@augusto-herrmann
Copy link

Is your feature request related to a problem? Please describe.
It may be a common use case that a marker might relate to other relevant makers. It would be great if a marker's popup could contain links to other markers.

Describe the solution you'd like
Have a standard way to include in a popup links to other markers. The link, once activated, would:

  • deactivate its own marker's popup,
  • center the map view on the target marker,
  • and activate the target marker's popup.

Describe alternatives you've considered
Just referencing the other marker by an id, with no link, but that is confusing, awkward, unwieldy, and impractical for the end user, which not only would have to keep in mind an id but also have to search for it around the map.

Additional context
That would make it possible for users to easily navigate between relevant markers.

However, activating markers by links might not be a feature that leaflet.js itself supports, I haven't checked yet.

@Conengmo Conengmo added the enhancement Feature request or idea about how to make folium better label Nov 17, 2022
@yschopfer19
Copy link

yschopfer19 commented Jan 23, 2024

Hello @augusto-herrmann,

I wanted to let you know that I implemented the possibility to link markers. Now, users can include links to other markers in a popup, which, when activated, closes the current popup, centers the map view on the target marker, and opens the target marker's popup.
You can see the changes I made in the #1863.
I hope this implementation meets your requirements. I would appreciate any feedback you may have.

Best Regards,
@yschopfer19

@augusto-herrmann
Copy link
Author

Hi @yschopfer19,

thanks for the implementation! It is appreciated. I have yet to find some time to try it out in practice, but from your description and code it already does seem pretty good and useful.

It could be even better if we could define our own custom markup. That is, by just using an identifier in the link within a popup's markup (e.g. <a href="#marker-2">go to marker popup 2</a>, it would then create the navigation and activation as you've described. That way authors would have more flexibility when creating the popup content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or idea about how to make folium better
Projects
None yet
Development

No branches or pull requests

3 participants