Last active
January 23, 2016 08:04
-
-
Save aagarw30/5821ec4c951669eb3c04 to your computer and use it in GitHub Desktop.
R Shiny and Leaflet # 4 - A simple map which demos setView() and addMarkers() functions and mapping "Taj Mahal, Agra, India"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(leaflet) | |
## renderLeaflet() is used at server side to render the leaflet map | |
shinyServer(function(input, output) { | |
output$mymap <- renderLeaflet({ | |
# define the leaflet map object | |
leaflet() %>% | |
addTiles() %>% | |
setView(lng = 78.0419, lat = 27.1750 , zoom = 15) %>% | |
addMarkers(lng = 78.0419, lat = 27.1750, popup = "Taj Mahal, Agra, India") # uncomment following if want to have a pop up %>% | |
# addPopups(lng = 78.0419, lat = 27.1750, popup = "Taj Mahal, Agra, India") | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(leaflet) | |
## leafletOutput is used at the ui side to display the rendered map. | |
shinyUI(fluidPage( | |
leafletOutput("mymap") | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment