leafletMap: Leaflet map module, Server logic

Description Usage Arguments Value Examples

View source: R/leafletmap_module.R

Description

Leaflet map module, Server logic

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
leafletMap(
  input,
  output,
  session,
  data,
  date_col = "datetime",
  points_col = "person_id",
  v_anim = 24,
  traj_col = "trajectory_id"
)

Arguments

data

A Dataframe, is supposed to contains "lat" and "lng" cols, otherwise things won't work

date_col

Chr. Name of the column identifying Date time reference.

points_col

Chr.Name of the colum of the Points in the map. (circles) The trajectories(polylines) are always represented with respect to this column reference.

v_anim

num. Speed of the time animation. 1 means 5 hours.

traj_col

Column idenifying the trajectories

Value

A shiny Module

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
require(shiny)
require(dplyr)
if(interactive()) {
df <- feather::read_feather("C://Users//Utente//Desktop//Maputo//transport_mode_detection//data_speed_acc_new.feather") %>%
  slice(1:100)
df <- rename(df, time = datetime, pid  = person_id, tid  = trajectory_id,)
ui <- fluidPage(
  leafletMapUi("map")
)
server <- function(input, output, session) {
  callModule(leafletMap, "map", data = df, v_anim = 1, date_col = "time", points_col = "pid", traj_col = "tid")
}
shinyApp(ui, server)
}

Davide-bll/Shinymod documentation built on April 17, 2021, 8:42 a.m.