Last active
January 23, 2016 08:05
-
-
Save aagarw30/d1484d59adfcd6e3ebda to your computer and use it in GitHub Desktop.
R Shiny and Leaflet # 5 - Mapping my birth location - Demo addMarkers() with minimal reproducible example
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) | |
# we use the renderLeaflet() at the server side for leaflet maps. | |
shinyServer(function(input, output) { | |
output$mymap <- renderLeaflet({ | |
# define the leaflet map object | |
leaflet() %>% | |
addTiles() %>% # default OSM base map tile | |
# Define lat , long and zoom level. Pass them into setView as arguments | |
setView(lng = 82.9739144,lat = 25.3176452, zoom = 2) %>% | |
# Add location marker to map using addMarkers() function | |
addMarkers(lng = 82.9739144, lat = 25.3176452, popup = "Varanasi - My Birth Place") | |
}) | |
}) |
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) | |
shinyUI(fluidPage( | |
leafletOutput("mymap") | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment