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

Adding tmap layers to Leaflet Proxy map #865

Open
James-G-Hill opened this issue Apr 18, 2024 · 1 comment
Open

Adding tmap layers to Leaflet Proxy map #865

James-G-Hill opened this issue Apr 18, 2024 · 1 comment

Comments

@James-G-Hill
Copy link

I was working on integrating tmap and leaflet this week in a package so that I can use tmap to create a static map then convert to leaflet when necessary & add any extra interactive elements on top. This is achievable with tmap_leaflet (although there were some annoyances such as the default converted Leaflet always showing 3 basemaps and then having to define the 1 basemap I want separately with tmap_options(basemaps).

I thought it would be great to define any layers that could be static in tmap and then convert to leaflet when I need to. This would reduce duplication of effort across tmap and leaflet.

However, one problem I came across is that I want to be able to use the layers I defined in leaflet with a proxy map. If I convert with tmap_leaflet I get a full leaflet map, not layers I can then add to a proxy map.

Is there any way to convert individual layers from tmap to leaflet format? Or extract layers from the output of tmap_leaflet and add them to another leaflet map.

I'm guessing this is not possible to do with the current version of tmap but maybe such an ability could be added in future?

Ultimately, I'd like to be able to define a tm_lines then convert to leaflet and attach it so that the lines and legend appear correctly on the leaflet map.

@mtennekes
Copy link
Member

I still have to migrate the tmapProxy/shiny integration in v4.

Your input is welcome, so thanks for that. However, I don't understand exactly what you mean yet. Are you looking for something like tmap_leaflet(tm, layers = c(1,3,5))? If so, why don't you just create a tmap with those layers?

Could you perhaps share a minimal use case / example, of something you want to achieve?

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

No branches or pull requests

2 participants