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

map.save() to support an option to export leaflet dependencies (js/css/icons) as inline base64 uris #1985

Open
prusswan opened this issue Jul 4, 2024 · 4 comments
Labels
enhancement Feature request or idea about how to make folium better

Comments

@prusswan
Copy link
Contributor

prusswan commented Jul 4, 2024

Is your feature request related to a problem? Please describe.

folium maps exported as html still depend on external leaflet dependencies (either from internet or on relative paths - manual modification is needed)

Describe the solution you'd like

Something similar to knit in RStudio (which produces the html with the inlined resources). I believe the R leaflet package is self-contained (it contains leaflet's resources), so for this to work in the same manner in folium, additional options to override default_js/default_css may be necessary (i.e. to point them to relative/static paths).

Describe alternatives you've considered

Out of various leaflet wrappers, RStudio's implementation is the closest.

Additional context

(Could attach one of html files created through RStudio's leaflet, if anyone needs it)

Implementation

Possibly, just to gauge the interest for now

@Conengmo
Copy link
Member

This is an interesting idea. But how would that work with tiles? You can set up local tiles, but that's a bit more involved.

@Conengmo Conengmo added the enhancement Feature request or idea about how to make folium better label Jul 26, 2024
@prusswan
Copy link
Contributor Author

This is an interesting idea. But how would that work with tiles? You can set up local tiles, but that's a bit more involved.

Ha, this is an "easy" one. Tiles are not part of leaflet's resources/dependencies, so they will continue to work in the same manner, with or without this enhancement.

@Conengmo
Copy link
Member

That’s fair :) but what’s the point of packing all the other resources then? I was thinking of the offline use case, but if that’s not the goal then what other use case are you thinking of?

@prusswan
Copy link
Contributor Author

prusswan commented Jul 27, 2024

That’s fair :) but what’s the point of packing all the other resources then? I was thinking of the offline use case, but if that’s not the goal then what other use case are you thinking of?

It is one step towards the offline use case, but of course folium cannot be expected to carry an entire set of tiles. Also, depending on the nature of the data, basemap tiles might not be needed (e.g. if they have world outlines as a data layer). Another related use case would be to modify default_css/default_js which is not exposed as parameters.

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

2 participants