Draw personalized polygons on leaflet map

14 views
Skip to first unread message

Rafael Batista

unread,
May 18, 2018, 4:17:16 PM5/18/18
to Shiny - Web Framework for R
Hi all.

Is it possible to draw polygons on leaflet markers?
Not predefined ones.

I want to be able to plot a triangle on every marker (which in this case are wind turbines).
The opening angle of the triangle is given as result of some equation and can change depending on the parameters considered. This is related to wake effect on wind turbines.

I put a picture of what I am thinking. Sorry for the bad drawing quality. I did in a hurry. I can provided one better if its not clear.

Is it possible to do such a thing?

Thanks folks!
wecs_example_edited.jpg

Luca Valnegri

unread,
May 19, 2018, 9:35:33 AM5/19/18
to Shiny - Web Framework for R
Hi Rafael, 

if it's the same new marker for every point why don't you create a new icon as you like, add it using makeIcon, and then use it instead of the default? 
You can actually also make multiple icons with different triangles to use conditionally on some attribute

Luca

Rafael Batista

unread,
May 19, 2018, 7:35:55 PM5/19/18
to Shiny - Web Framework for R
Hi Luca.

Thanks for your suggestion.

Your idea is to create an entire new icon with the triangles included instead of ploting the markers and then figured out how to plot the triangles... right?
Its a good approach. I havent think of it yet. If you look at the rstudio forum Joe posted another interesting solution: https://community.rstudio.com/t/draw-personalized-polygons-on-leaflet-map-withim-shiny/8581

Thanks.
Reply all
Reply to author
Forward
0 new messages