google_map-shiny | R Documentation |
Output and render functions for using google_map within Shiny applications and interactive Rmd documents.
google_mapOutput(outputId, width = "100%", height = "400px")
renderGoogle_map(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height |
Must be a valid CSS unit (like |
expr |
An expression that generates a google_map |
env |
The environment in which to evaluate |
quoted |
Is |
## Not run:
library(shiny)
library(googleway)
ui <- fluidPage(google_mapOutput("map"))
server <- function(input, output, session){
api_key <- "your_api_key"
output$map <- renderGoogle_map({
google_map(key = api_key)
})
}
shinyApp(ui, server)
## using split view
library(shinydashboard)
library(googleway)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
box(width = 6,
google_mapOutput(outputId = "map")
),
box(width = 6,
google_mapOutput(outputId = "pano")
)
)
)
server <- function(input, output) {
#set_key("your_api_key")
output$map <- renderGoogle_map({
google_map(location = c(-37.817386, 144.967463),
zoom = 10,
split_view = "pano")
})
}
shinyApp(ui, server)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.