From b9413fb54cd16fb05ec529c9362ba6f198c7502e Mon Sep 17 00:00:00 2001 From: dcooley Date: Tue, 19 Mar 2024 13:48:24 +1100 Subject: [PATCH] callback parameter for #271 --- DESCRIPTION | 2 +- R/google_map.R | 14 ++++++++----- man/access_result.Rd | 50 ++++++++++++++++++++++---------------------- man/clear.Rd | 4 ++-- man/google_map.Rd | 1 + 5 files changed, 38 insertions(+), 33 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ca610f36..42d6bcde 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,7 +30,7 @@ Imports: scales, grDevices, googlePolylines (>= 0.7.1) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 BugReports: https://github.com/SymbolixAU/googleway/issues Suggests: knitr, diff --git a/R/google_map.R b/R/google_map.R index 9cdcefac..8b79a7b4 100644 --- a/R/google_map.R +++ b/R/google_map.R @@ -125,6 +125,7 @@ google_map <- function(data = NULL, rotate_control = TRUE, fullscreen_control = TRUE, libraries = NULL, + callback = NULL, split_view = NULL, split_view_options = NULL, geolocation = FALSE, @@ -155,14 +156,17 @@ google_map <- function(data = NULL, split_view_options <- splitViewOptions(split_view_options) - if(is.null(libraries)) + if(is.null(libraries)) { libraries <- c("visualization", "geometry", "places", "drawing") + } - if(is.null(location)) - location <- c(0, 0) ## Melbourne, Australia + if(is.null(location)) { + location <- c(0, 0) + } - if(is.null(zoom)) + if(is.null(zoom)) { zoom <- 1 + } # forward options using x x = list( @@ -211,7 +215,7 @@ google_map <- function(data = NULL, ## CHARTS2 header <- paste0('', + key, '&libraries=', paste0(libraries, collapse = ","), if(!is.null(callback)) {paste0("&callback=", callback)}, '">', '') googlemap$dependencies <- c( diff --git a/man/access_result.Rd b/man/access_result.Rd index fc70eae2..2a402c16 100644 --- a/man/access_result.Rd +++ b/man/access_result.Rd @@ -96,55 +96,55 @@ Methods for accessing specific elements of a Google API query. } \section{Functions}{ \itemize{ -\item \code{direction_instructions}: the instructions from a directions query +\item \code{direction_instructions()}: the instructions from a directions query -\item \code{direction_routes}: the routes from a directions query +\item \code{direction_routes()}: the routes from a directions query -\item \code{direction_legs}: the legs from a directions query +\item \code{direction_legs()}: the legs from a directions query -\item \code{direction_steps}: the steps from a directions query +\item \code{direction_steps()}: the steps from a directions query -\item \code{direction_points}: the points from a directions query +\item \code{direction_points()}: the points from a directions query -\item \code{direction_polyline}: the encoded polyline from a direction query +\item \code{direction_polyline()}: the encoded polyline from a direction query -\item \code{distance_origins}: the origin addresses from a distance query +\item \code{distance_origins()}: the origin addresses from a distance query -\item \code{distance_destinations}: the destination addresses from a distance query +\item \code{distance_destinations()}: the destination addresses from a distance query -\item \code{distance_elements}: the element results from a distance query +\item \code{distance_elements()}: the element results from a distance query -\item \code{elevation}: the elevation from an elevation query +\item \code{elevation()}: the elevation from an elevation query -\item \code{elevation_location}: the elevation from an elevation query +\item \code{elevation_location()}: the elevation from an elevation query -\item \code{geocode_coordinates}: the coordinates from a geocode or reverse geocode query +\item \code{geocode_coordinates()}: the coordinates from a geocode or reverse geocode query -\item \code{geocode_address}: the formatted address from a geocode or reverse geocode query +\item \code{geocode_address()}: the formatted address from a geocode or reverse geocode query -\item \code{geocode_address_components}: the address components from a geocode or reverse geocode query +\item \code{geocode_address_components()}: the address components from a geocode or reverse geocode query -\item \code{geocode_place}: the place id from a geocode or reverse geocode query +\item \code{geocode_place()}: the place id from a geocode or reverse geocode query -\item \code{geocode_type}: the geocoded place types from a geocode or reverse geocode query +\item \code{geocode_type()}: the geocoded place types from a geocode or reverse geocode query -\item \code{place}: the place_id from a places query +\item \code{place()}: the place_id from a places query -\item \code{place_next_page}: the next page token from a places query +\item \code{place_next_page()}: the next page token from a places query -\item \code{place_name}: the place name from a places query +\item \code{place_name()}: the place name from a places query -\item \code{place_location}: the location from a places query +\item \code{place_location()}: the location from a places query -\item \code{place_type}: the type of place from a places query +\item \code{place_type()}: the type of place from a places query -\item \code{place_hours}: the opening hours from a place details query +\item \code{place_hours()}: the opening hours from a place details query -\item \code{place_open}: the open now result from a place details query +\item \code{place_open()}: the open now result from a place details query -\item \code{nearest_roads_coordinates}: the coordinates from a nearest roads query -}} +\item \code{nearest_roads_coordinates()}: the coordinates from a nearest roads query +}} \examples{ \dontrun{ diff --git a/man/clear.Rd b/man/clear.Rd index 146cf2d2..f383b070 100644 --- a/man/clear.Rd +++ b/man/clear.Rd @@ -65,9 +65,9 @@ clears elements from a map } \section{Functions}{ \itemize{ -\item \code{remove_drawing}: removes drawing controls from a map -}} +\item \code{remove_drawing()}: removes drawing controls from a map +}} \note{ These operations are intended for use in conjunction with \link{google_map_update} in an interactive shiny environment diff --git a/man/google_map.Rd b/man/google_map.Rd index 7a8f4ce6..9d2171f5 100644 --- a/man/google_map.Rd +++ b/man/google_map.Rd @@ -27,6 +27,7 @@ google_map( rotate_control = TRUE, fullscreen_control = TRUE, libraries = NULL, + callback = NULL, split_view = NULL, split_view_options = NULL, geolocation = FALSE,