From e04a1fa20aa7d82d76117d0a7196be6d6c8424cf Mon Sep 17 00:00:00 2001 From: stevenpbachman Date: Sun, 17 Dec 2023 19:19:22 +0000 Subject: [PATCH 1/4] fixed recordedBy typo and wrong field map for recordNumber --- R/app.R | 2 +- R/import-data.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/app.R b/R/app.R index dc4da6b..666dd00 100644 --- a/R/app.R +++ b/R/app.R @@ -682,7 +682,7 @@ geocatApp <- function(...) { paste('',used_points$genus,used_points$specificEpithet,''), paste(sep='','Latitude,Longitude ',used_points$latitude,',',used_points$longitude), paste('locality', used_points$locality,'Uncertainty',used_points$coordinateUncertaintyInMeters,'m'), - paste('Collector',used_points$recorderBy, 'Year', used_points$event_year), + paste('Collector',used_points$recordedBy, 'Number', used_points$recordNumber, 'Year', used_points$event_year), paste('','Catalog', used_points$catalogNumber,'Source',used_points$source,''), paste('','GeoCAT id' , used_points$geocat_id,'GeoCAT notes', used_points$geocat_notes,'') ) diff --git a/R/import-data.R b/R/import-data.R index 6329a3d..4350911 100644 --- a/R/import-data.R +++ b/R/import-data.R @@ -134,7 +134,7 @@ gbif_points_ <- function(points) { spatialref="geodeticDatum", source="occurrenceID", recordedBy="recordedBy", - recordNumber="collectionCode", + recordNumber="recordNumber", datasetKey="datasetKey" ) From e5bda17fb76534b8f517c80311f78a6ac2e302a1 Mon Sep 17 00:00:00 2001 From: stevenpbachman Date: Sun, 17 Dec 2023 22:16:55 +0000 Subject: [PATCH 2/4] added gbif ID for URL link on popup --- R/app.R | 7 ++++--- R/import-data.R | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/R/app.R b/R/app.R index 666dd00..606ce77 100644 --- a/R/app.R +++ b/R/app.R @@ -682,11 +682,12 @@ geocatApp <- function(...) { paste('',used_points$genus,used_points$specificEpithet,''), paste(sep='','Latitude,Longitude ',used_points$latitude,',',used_points$longitude), paste('locality', used_points$locality,'Uncertainty',used_points$coordinateUncertaintyInMeters,'m'), - paste('Collector',used_points$recordedBy, 'Number', used_points$recordNumber, 'Year', used_points$event_year), + paste('Collector',used_points$recordedBy,'Number', used_points$recordNumber, 'Year', used_points$event_year), paste('','Catalog', used_points$catalogNumber,'Source',used_points$source,''), - paste('','GeoCAT id' , used_points$geocat_id,'GeoCAT notes', used_points$geocat_notes,'') + paste('','GeoCAT id', used_points$geocat_id,'GeoCAT notes', used_points$geocat_notes,''), + paste('', 'GBIF occurrence', 'GBIF occurrence link', '') ) - + leafletProxy("mymap") %>% leaflet::addCircleMarkers( popup = ~pcontent, diff --git a/R/import-data.R b/R/import-data.R index 4350911..fd2c13c 100644 --- a/R/import-data.R +++ b/R/import-data.R @@ -135,7 +135,8 @@ gbif_points_ <- function(points) { source="occurrenceID", recordedBy="recordedBy", recordNumber="recordNumber", - datasetKey="datasetKey" + datasetKey="datasetKey", + gbifID="gbifID" ) points_list <- sapply( @@ -145,6 +146,8 @@ gbif_points_ <- function(points) { USE.NAMES=TRUE ) + points_list$gbifID <- paste0("https://www.gbif.org/occurrence/", points_list$gbifID) + dplyr::as_tibble(points_list) } From 0fa7c97e51d18f5e12784fb47d70c766bb20ddcc Mon Sep 17 00:00:00 2001 From: stevenpbachman Date: Sun, 17 Dec 2023 22:18:14 +0000 Subject: [PATCH 3/4] updated popup to open external window --- R/app.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/app.R b/R/app.R index 606ce77..ff16d5d 100644 --- a/R/app.R +++ b/R/app.R @@ -685,7 +685,7 @@ geocatApp <- function(...) { paste('Collector',used_points$recordedBy,'Number', used_points$recordNumber, 'Year', used_points$event_year), paste('','Catalog', used_points$catalogNumber,'Source',used_points$source,''), paste('','GeoCAT id', used_points$geocat_id,'GeoCAT notes', used_points$geocat_notes,''), - paste('', 'GBIF occurrence', 'GBIF occurrence link', '') + paste('', 'GBIF ID', 'GBIF occurrence link', '') ) leafletProxy("mymap") %>% From 7f8dba0928a951262070f688cd3578b6daf2c496 Mon Sep 17 00:00:00 2001 From: stevenpbachman Date: Sun, 17 Dec 2023 22:48:45 +0000 Subject: [PATCH 4/4] trigger map zoom to analysis bounding box when analysis switched on --- R/app.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/app.R b/R/app.R index ff16d5d..1ad7d63 100644 --- a/R/app.R +++ b/R/app.R @@ -723,8 +723,11 @@ geocatApp <- function(...) { shiny::observeEvent(list(input$Analysis, values$eoo_polygon, values$aoo_polygon), { if (input$Analysis & !is.null(values$aoo_polygon)){ + bb_aoo <- sf::st_bbox(values$aoo_polygon) leaflet::leafletProxy("mymap", data=values$aoo_polygon) %>% leaflet::clearGroup("AOOpolys") %>% + #zoom to + leaflet::fitBounds(bb_aoo[[1]], bb_aoo[[2]], bb_aoo[[3]], bb_aoo[[4]]) %>% leaflet::addPolygons( color = "#000000", stroke = T,