Add buttons to perform actions on the leaflet map.

0 votes
Can anyone help me explain how to add buttons to perform actions on the leaflet map?
Oct 14 in Data Analytics by ch
• 3,290 points
21 views

1 answer to this question.

0 votes

@ch,

You can add easy buttons to add small JS events using addEasyButton() function.

Check out the below example -

leaflet() %>% addTiles() %>%
  addEasyButton(easyButton(
    icon="fa-globe", title="Zoom to Level 1",
    onClick=JS("function(btn, map){ map.setZoom(1); }"))) %>%
  addEasyButton(easyButton(
    icon="fa-crosshairs", title="Locate Me",
    onClick=JS("function(btn, map){ map.locate({setView: true}); }")))

Find more information about the example from the below link,

https://rstudio.github.io/leaflet/morefeatures.html

answered Oct 14 by Cherukuri
• 31,840 points

Related Questions In Data Analytics

0 votes
1 answer

How to add regression line equation and R2 on graph?

Below is one solution: # GET EQUATION AND ...READ MORE

answered Jun 1, 2018 in Data Analytics by DataKing99
• 8,130 points
868 views
0 votes
1 answer
0 votes
1 answer

How do I add Icons to my messages on my dashboard which I’m creating using shiny r?

Try something like this: dashboardHeader(title="Edureka", dropdownMenu type = "message", messageItem(from = ...READ MORE

answered Nov 29, 2018 in Data Analytics by Maverick
• 10,040 points
62 views
0 votes
1 answer

Add radio buttons on shiny R dashboard

Yess of course that's possible. ShinyR provides ...READ MORE

answered Dec 5, 2018 in Data Analytics by Maverick
• 10,040 points
772 views
0 votes
1 answer

plot map points from a dataframe

Hi Peter, Use below code. leaflet(df) %>% addTiles() %>% ...READ MORE

answered Sep 17 in Data Analytics by priya
19 views
0 votes
1 answer

How to add external markers in maps?

Use external markers by creating icons using ...READ MORE

answered Oct 14 in Data Analytics by Cherukuri
• 31,840 points
20 views
0 votes
0 answers

fix the map area using leaflet and use ggplot

I created a map using leaflet and ...READ MORE

Sep 18 in Data Analytics by anonymous
• 31,840 points
17 views
0 votes
1 answer

How to save leaflet object as an image?

Yes, you can save leaflet objects as ...READ MORE

answered Oct 28 in Data Analytics by Cherukuri
• 31,840 points
42 views
0 votes
1 answer

How to add legend or any text on the map in leaflet?

See below example, > p = colorFactor(palette = ...READ MORE

answered Oct 28 in Data Analytics by anonymous
• 31,840 points
36 views
0 votes
1 answer

How to add labels on bars in bar chart in ggplot?

Use geom_text() to add labels on the ...READ MORE

answered Aug 20 in Data Analytics by anonymous
• 31,840 points
30 views