Skip to content

Commit

Permalink
Merge pull request #117 from stevenpbachman/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes - popup and zoom
  • Loading branch information
stevenpbachman authored Dec 17, 2023
2 parents ab955e9 + 7f8dba0 commit 99a6296
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions R/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,12 @@ geocatApp <- function(...) {
paste('<b><i><font size = "3">',used_points$genus,used_points$specificEpithet,'</font></i></b>'),
paste(sep='','<b>Latitude,Longitude </b>',used_points$latitude,',',used_points$longitude),
paste('<b>locality</b>', used_points$locality,'<b>Uncertainty</b>',used_points$coordinateUncertaintyInMeters,'m'),
paste('<b>Collector</b>',used_points$recorderBy, '<b>Year</b>', used_points$event_year),
paste('<b>Collector</b>',used_points$recordedBy,'<b>Number</b>', used_points$recordNumber, '<b>Year</b>', used_points$event_year),
paste('<font size = "1">','<b>Catalog</b>', used_points$catalogNumber,'<b>Source</b>',used_points$source,'</font>'),
paste('<font size = "1">','<b>GeoCAT id</b>' , used_points$geocat_id,'<b>GeoCAT notes</b>', used_points$geocat_notes,'</font>')
paste('<font size = "1">','<b>GeoCAT id</b>', used_points$geocat_id,'<b>GeoCAT notes</b>', used_points$geocat_notes,'</font>'),
paste('<font size="1">', '<b>GBIF ID</b>', '<a href="', used_points$gbifID, '" target="_blank">GBIF occurrence link</a>', '</font>')
)

leafletProxy("mymap") %>%
leaflet::addCircleMarkers(
popup = ~pcontent,
Expand Down Expand Up @@ -722,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,
Expand Down
7 changes: 5 additions & 2 deletions R/import-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ gbif_points_ <- function(points) {
spatialref="geodeticDatum",
source="occurrenceID",
recordedBy="recordedBy",
recordNumber="collectionCode",
datasetKey="datasetKey"
recordNumber="recordNumber",
datasetKey="datasetKey",
gbifID="gbifID"
)

points_list <- sapply(
Expand All @@ -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)
}

Expand Down

0 comments on commit 99a6296

Please sign in to comment.