google_map-shiny: Shiny bindings for google_map

google_map-shinyR Documentation

Shiny bindings for google_map

Description

Output and render functions for using google_map within Shiny applications and interactive Rmd documents.

Usage

google_mapOutput(outputId, width = "100%", height = "400px")

renderGoogle_map(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a google_map

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Examples

## 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)


googleway documentation built on Aug. 22, 2023, 9:13 a.m.