Is it possible to control Panel from Folium map?

I am building a dashboard with Panel where I summarize meteorological observations stations, and it made sense to be able to search for stations on a map, so I was planning on a two part or two page app, where the user finds a station of interest on a map and then clicks it, and then it will navigate to the station summary dashboard.

I am having trouble trying to connect the map widget from the Folium pane and controlling the rest of the Panel dashboard from the Folium page. I didn’t see any obvious way to control other widgets from Folium, so I thought that I can just have links to the station page from the markers as pop-ups, like so:

Clicking the link will go to a new page with some station summaries and statistics:

Now the problem I am running into is that I don’t want the links to cold open a new page. I was considering two possibilities, but I’m not sure if they are possible…

Idea 1: Implement Map and Summary on different tabs

Clicking the link/button will communicate to Panel the station ID and the app will switch to a new tab and pull information for the station of interest.

However, I’m not sure if it is possible to add bi-directional communication between the Folium map and the rest of the Panel dashboard.

Idea 2: Link opens a new window to a different Panel app that generates a summary

This is easier to do and the current direction I am going. I can just create a link to a different Panel dashboard and communicate the station ID through the URL via the capabilities explained in Access and Manipulate the URL — Panel v1.4.0 ( (e.g., I will append “?stn_id=1234” and then the app will grab the selected station from the URL and then run)

The only downside is that I don’t want the app to cold start every time a link is clicked, and it takes a few seconds to initialize. Is there a way to open a new page and pass along an updated state to the new panel app so that it can just query the updated URL? My gut tells me no…

Idea 3: …?

Or is there a better way to implement this?

Thanks for any pointers, I’m rather new to creating Panel dashboards.

Do you absolutely need folium? If not, I think the communication channel between a Bokeh plot + Panel is much more established.

1 Like