From 3cff2b41d80e86c00d112d003be328ded385b974 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 16 Mar 2022 20:35:13 +1100 Subject: [PATCH 1/2] where zoomto is not provided and/or and sf object is not provided the map will pan to Africa. This handles editAttributes() call --- R/editAttributes.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/R/editAttributes.R b/R/editAttributes.R index 0ebaafa..1585c67 100644 --- a/R/editAttributes.R +++ b/R/editAttributes.R @@ -75,10 +75,16 @@ #' } editAttributes <- function(dat, zoomto = NULL, col_add = TRUE, reset = TRUE, provider = 'Esri.WorldImagery', testing = FALSE){ + DEFAULT_ZOOM <- 'africa' + MSG <- 'When neither sf object nor zoomto is default, map will zoom to Africa' #create base df if dat missing if (missing(dat)) { dat <- data.frame(id = 'CHANGE ME', comments = 'ADD COMMENTS...') %>% mutate(leaf_id = 1) + if (is.null(zoomto)) { + message(MSG) + zoomto <- DEFAULT_ZOOM + } } APP_CRS <- 4326 @@ -105,6 +111,11 @@ editAttributes <- function(dat, zoomto = NULL, col_add = TRUE, reset = TRUE, pro user_crs <- APP_CRS le = TRUE + if (is.null(zoomto)) { + message(MSG) + zoomto <- DEFAULT_ZOOM + } + } else if (any(type %in% class(dat))) { dat <- dat %>% mutate(leaf_id = 1:nrow(dat)) %>% sf::st_transform(APP_CRS) From 2bd3d1842af4bc20e0de88a8fec8a145bda724af Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 16 Mar 2022 20:43:35 +1100 Subject: [PATCH 2/2] update namespace --- NAMESPACE | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a951c25..272a9ac 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,7 +14,6 @@ export(editFeatures) export(editMap) export(editMod) export(editModUI) -export(mapeditAddin) export(selectFeatures) export(selectMap) export(selectMod) @@ -33,17 +32,7 @@ importFrom(DT,datatable) importFrom(DT,editData) importFrom(DT,renderDataTable) importFrom(DT,replaceData) -importFrom(leaflet,setView) -importFrom(mapview,mapview) -importFrom(miniUI,gadgetTitleBar) -importFrom(miniUI,miniButtonBlock) -importFrom(miniUI,miniContentPanel) -importFrom(miniUI,miniPage) -importFrom(rstudioapi,getActiveDocumentContext) -importFrom(sf,write_sf) importFrom(shinyWidgets,actionBttn) importFrom(shinyWidgets,show_alert) -importFrom(shinyWidgets,switchInput) -importFrom(shinyWidgets,updateSwitchInput) importFrom(shinyWidgets,useSweetAlert) importFrom(tmaptools,geocode_OSM)