Spaces:
Sleeping
Sleeping
File size: 1,199 Bytes
66a02d0 639cb71 a9b986b 66a02d0 639cb71 66a02d0 639cb71 c16eece 66a02d0 9d335d0 07d31be 9d335d0 a9b986b 472188c 66a02d0 133e140 07d31be 0118a3f 133e140 66a02d0 133e140 639cb71 9f1c48e 133e140 0118a3f 9f1c48e 07d31be 9f1c48e 0118a3f 9f1c48e 0118a3f 639cb71 66a02d0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
library(shinybusy)
library(shiny)
library(bslib)
library(colourpicker)
library(mapgl)
library(sf)
library(dplyr)
library(duckdbfs)
library(overture)
source("utils.R")
source("inat-ranges.R")
duckdb_config(threads = 24) # I/O limited so overclock threads
ui <- page_sidebar(
shinybusy::add_busy_spinner(),
title = "iNaturalist Species Ranges",
sidebar = sidebar(
textInput("location", "Location", "United States"),
varSelectInput("rank", NULL, taxa, selected = "class"),
textInput("taxon", NULL, "Aves"),
actionButton("button", "Go")
),
card(
full_screen = TRUE,
maplibreOutput("map")
)
)
server <- function(input, output, session) {
# Create reactive expressions that only trigger when button is clicked
aoi_reactive <- eventReactive(input$button, {
get_division(input$location)
})
url_reactive <- eventReactive(input$button, {
aoi <- aoi_reactive()
richness(inat, aoi, rank = input$rank, taxon = input$taxon)
})
output$map <- renderMaplibre({
# This will only render when button is clicked
url <- url_reactive()
aoi <- aoi_reactive()
print(url)
m <- richness_map(url, aoi)
m
})
}
shinyApp(ui, server)
|