Hi! First of all, thanks everyone for Folium. Totally love it.
My question is: is there a plan to support drawing text directly on maps, instead of as a popup? (something like this: Google Maps JS Map Label)
I'm guessing there isn't because it doesn't look like it's supported in Leaflet either, but just wanted to check. Thanks much!
(also, sorry if this is not the best place to ask - let me know if so.)
Hi! First of all, thanks everyone for Folium. Totally love it.
Thanks!
My question is: is there a plan to support drawing text directly on maps, instead of as a popup?
Plans? No. But that is definitely a nice feature to have.
(something like this: Google Maps JS Map Label)
I'm guessing there isn't because it doesn't look like it's supported in Leaflet either, but just wanted to check. Thanks much!
Maybe leaflet has something similar. If you can find it it should not be too hard to implement.
(also, sorry if this is not the best place to ask - let me know if so.)
It is.
This is something that was supposed to be possible with DivIcon ; idea base on #166.
I must admit that DivIcon is not ready today.
But a small hack leads to the result: see http://nbviewer.jupyter.org/gist/BibMartin/ec2a96034043a7d5035b
If one of you two beats me at doing the PR, it'd be great.
Awesome! I can see a few more uses for that too :wink:
I am away from "fun work" for a while. My laptop is dead and I am doing only the essential for my day job with a borrowed one :unamused:
Hey, neat, thanks! (sorry about the delay, this is "fun work" for me too :) Looks like DivIcon does the trick, really. Like this:
from folium.features import DivIcon
m = folium.Map([34.0302, -118.2352], zoom_start=13)
folium.map.Marker(
[34.0302, -118.2352],
icon=DivIcon(
icon_size=(150,36),
icon_anchor=(0,0),
html='<div style="font-size: 24pt">Test</div>',
)
).add_to(m)
(I'd be happy to write a PR, but I'm not sure what else you want it to do. Looks fine to me.)
@dantasse
(I'd be happy to write a PR, but I'm not sure what else you want it to do. Looks fine to me.)
Thanks for proposing ; well it's not the funniest part, but it would be great to take the occasion to complete the docstring, and (eventually) provide a test.
Hi again! Had a minute to look into this and I can't really figure out what's wrong with the docstring still. And there's a test that makes a DivIcon in tests/test_features.py - seems basic but it works?
If it's helpful for you, you can point me in the right direction about what still needs to be done here, and I can try to make sure all the details are right and create a PR. But I realize this is a tiny thing and helping me get started here will likely be more trouble than it's worth, so no worries if you don't get a chance.
Thanks again!
This issue seems no longer relevant, since DivIcon provides the requested functionality. Its docstring seems good enough.
It appears this is not included in the 0.6.0 release. Is there an alternative method to add text in the release version?
@Allenite see https://github.com/python-visualization/folium/issues/340#issuecomment-383370607
DivIcon is available since before v0.6.0 BTW.
Got it, thanks!
Most helpful comment
Hey, neat, thanks! (sorry about the delay, this is "fun work" for me too :) Looks like DivIcon does the trick, really. Like this:
(I'd be happy to write a PR, but I'm not sure what else you want it to do. Looks fine to me.)