folium icon indicating copy to clipboard operation
folium copied to clipboard

Add PolylineDecorator plugin

Open hashir107 opened this issue 6 years ago • 7 comments

Hi All,

It would be great if we could get PolylineDecorator extension for folium. It helps to beautify the lines like for example adding arrows and etc.

https://github.com/bbecquet/Leaflet.PolylineDecorator

hashir107 avatar Oct 07 '19 14:10 hashir107

Hi @hashir107, nice suggestion, we do already have some plugins to change how polylines look but not exactly like this one.

We have a polyline offset plugin that is quite versatile: https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/plugin-PolyLineOffset.ipynb

And we have polyline textpath and antpath that can do a lot: https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/PolyLineTextPath_AntPath.ipynb

So given that we already have some plugins to style polylines I would say adding PolylineDecorator is not a priority. I'll leave the issue open though, so if someone wants to pick it up, PR's are welcome.

Note however that to get the PR accepted it has to adhere to certain criteria. It has to be simple and stand-alone. We don't want to burden ourselves with maintenance. Read more about this here: https://github.com/python-visualization/folium/issues/1080#issuecomment-471319344

Conengmo avatar Oct 07 '19 14:10 Conengmo

Hey,

Thanks a lot, I will check the links you mentioned now.

If nobody picks it up, maybe I am able to do it in couple of months.

Best, Hashir

hashir107 avatar Oct 07 '19 14:10 hashir107

I assume nobody will pick it up :) so if you want it made, you're the one to do it. A good starting point would be copying this plugin: https://github.com/python-visualization/folium/blob/master/folium/plugins/polyline_offset.py

Conengmo avatar Oct 07 '19 14:10 Conengmo

Hello,

I'm not well-versed in Javascript or with the more object-oriented parts of Python, or the use of github for that matter, but I've managed to work out the rudimentary beginnings of a version of the polyline decorator plugin for folium.

At the moment I've only made it to work with drawing arrowheads (because I'd have to deal with what to do about the Leaflet Symbol objects if the user can choose) and I may not be doing things in entirely the right way, but I think I've got the rudimentary beginnings of something that could work.

I've done this all locally by cloning the repository, because I am not sure of the correct way to make the changes and have you see them in github, but here is a screenshot of the new plugin in action in a Jupyter Notebook:

image

If anyone were willing to give me a hand with getting this either finished or submitted as a work in progress, or maybe someone will tell me that this has already been done by someone else, then I will be grateful!

Mark.

markhudson42 avatar Aug 18 '20 09:08 markhudson42

ok, so I have forked the folium repo and I shall see what I can do about creating the updated code files, documentation and examples and get back to you when I have an update.

Mark.

markhudson42 avatar Aug 18 '20 11:08 markhudson42

@markhudson42 Thanks for sharing and the arrowed polyline created for folium seems pretty useful and convenient to me! But I can see that PolyLineDecorator plugin hasn't been incorporated in the folium plugins right now. So is there a way you can share your method on this?

lymine1996 avatar Dec 22 '20 18:12 lymine1996

Hello,

I'm not well-versed in Javascript or with the more object-oriented parts of Python, or the use of github for that matter, but I've managed to work out the rudimentary beginnings of a version of the polyline decorator plugin for folium.

At the moment I've only made it to work with drawing arrowheads (because I'd have to deal with what to do about the Leaflet Symbol objects if the user can choose) and I may not be doing things in entirely the right way, but I think I've got the rudimentary beginnings of something that could work.

I've done this all locally by cloning the repository, because I am not sure of the correct way to make the changes and have you see them in github, but here is a screenshot of the new plugin in action in a Jupyter Notebook:

image

If anyone were willing to give me a hand with getting this either finished or submitted as a work in progress, or maybe someone will tell me that this has already been done by someone else, then I will be grateful!

Mark.

@markhudson42 Good day Mark, have you already finished doing the PolyLineDecorator for the folium.plugin? May we request for it? I am planning to input a GPX file then plot it with Arrowheads instead for Python Folium Thank you

rjaraza24 avatar Mar 31 '22 02:03 rjaraza24