I want to place text anywhere, as though it were part of a tile, no text box around it, and "shown on opening" (ie, show=True).

I don't see any text overlays in the documentation: https://python-visualization.github.io/folium/modules.html

Pure Leaflet appears to allow something like the "sweet static label" on display here: http://leaflet.github.io/Leaflet.label The code for this is:

var m = L.marker([-37.785, 175.263], {draggable:true}).bindLabel('A sweet static label!', { noHide: true })

That's better. But I would like text only.


I've never used Folium, but since I'm familiar with Leaflet, I was able to quickly find what you are looking for: folium.features.DivIcon. Description says: Represents a lightweight icon for markers that uses a simple div element instead of an image.

Since content of DivIcon is a simple HTML <div> element, you can put anything you want in it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.