Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add plotting for points without lat/long #90

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions server.R
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,24 @@ shinyServer(
lng_plotted <-
as.numeric(unlist(data_active() %>%
dplyr::select(input$map_lng_select)))

# replace missing lat/long with standard locations chosen by 'nonplotted' input
if(input$nonplotted == 'mid Atlantic'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- -20
} else if(input$nonplotted == 'south Pacific'){
lat_plotted[is.na(lat_plotted)] <- -65
lng_plotted[is.na(lng_plotted)] <- -124
} else if(input$nonplotted == 'mid Pacific'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- -165
} else if(input$nonplotted == 'Equator 0 degrees'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- 0
} else if(input$nonplotted == 'Greenland'){
lat_plotted[is.na(lat_plotted)] <- 75
lng_plotted[is.na(lng_plotted)] <- -40
}

if (input$atlas_color_by_select != "") {
color_user <- input$atlas_color_by_select
Expand Down Expand Up @@ -826,6 +844,26 @@ shinyServer(
as.numeric(unlist(data_active() %>%
dplyr::select(input$map_lng_select)))

# replace missing lat/long with standard locations chosen by 'nonplotted' input
if(input$nonplotted == 'mid Atlantic'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- -20
} else if(input$nonplotted == 'south Pacific'){
lat_plotted[is.na(lat_plotted)] <- -65
lng_plotted[is.na(lng_plotted)] <- -124
} else if(input$nonplotted == 'mid Pacific'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- -165
} else if(input$nonplotted == 'Equator 0 degrees'){
lat_plotted[is.na(lat_plotted)] <- 0
lng_plotted[is.na(lng_plotted)] <- 0
} else if(input$nonplotted == 'Greenland'){
lat_plotted[is.na(lat_plotted)] <- 75
lng_plotted[is.na(lng_plotted)] <- -40
}



if (input$atlas_color_by_select != "") {
color_user <- input$atlas_color_by_select
factpal <- colorFactor(RColorBrewer::brewer.pal(9, 'Set1'),
Expand Down
7 changes: 6 additions & 1 deletion ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ body <- dashboardBody(
tabPanel("Configure Map",
wellPanel(fluidRow(
column(2,
uiOutput("map_columns")
uiOutput("map_columns"),
selectInput("nonplotted",
label = "Select where to plot studies without lat/long",
choices = c('mid Atlantic', 'south Pacific', 'mid Pacific', 'Equator 0 degrees', 'Greenland'),
selected = 'mid Atlantic'
)
),
column(4,
uiOutput("atlas_popups"),
Expand Down