Skip to contents

Handles the data frame returned by shiny::fileInput(), including multi-file uploads of shapefile sidecars (.shp, .dbf, .shx, .prj) and zipped archives containing any supported format. When upload is NULL or empty the function returns NULL so callers can fall back to demo data.

Usage

read_dragmapr_sf_upload(upload)

Arguments

upload

The value of input$<id> from a shiny::fileInput() widget. Each row is one uploaded file with name and datapath columns. When NULL or a zero-row data frame, returns NULL.

Value

An sf object, or NULL if upload is NULL or empty.

Examples

# Typical Shiny server usage:
if(interactive()){
observeEvent(input$spatial_upload, {
  x <- read_dragmapr_sf_upload(input$spatial_upload)
  if (!is.null(x)) {
    state$source <- x
  }
})
}