Error with sf package when uploading to shinyapps.io

I've been working on an R shiny app that visualizes parking zones on a college campus using the sf and leaflet packages. Everything works fine locally, but when I try uploading the app to shinyapps.io I recieve the following error:


I've tried updating / reinstalling the sf package, connecting to GitHub via devtools to access sf, and looked at similar troubleshooting problems but cannot find the solution. Any suggestions on how I might resolve my error will be greatly appreciated!

Link to R App files: https://github.com/ecypher/parkingmap

R Code:

#Packages

library(sf)
library(shiny)
library(shinyWidgets)
library(leaflet)
library(leaflet.extras)
library(DT)


#Define palette and options for legend

simple_list <- c("Always","Sometimes")

legend_options <- factor(simple_list, labels = c("Always","Sometimes"))

pal_legend <- colorFactor(palette = c("forestgreen","gold1"),
                          domain = legend_options,
                          ordered = FALSE)


ui <- fluidPage(
              div(img(src = "GMU_RULEZ.png", height = "80px", width = "100%", align = "middle")),
              
              p(),
  
              column(width = 4, align = "center",
                               
                               br(),
                               
                               pickerInput("permit_or_visitor",label = "Are you a permit holder or visitor?", choices = c('Active Permit Holder','Visitor'),
                                           multiple = FALSE, selected = 'Active Permit Holder', options = list(`actions-box` = TRUE,`none-selected-text` = "Nothing Selected",`live-search` = TRUE)),
                               
                               conditionalPanel("input.permit_or_visitor == 'Active Permit Holder'",
                                                
                                                pickerInput("permit_type",label = "Permit Type?",
                                                            choices = c("Mason Pond Evening (D1AE18)",
                                                                        "Mason Pond F/S (D1FA18)",
                                                                        "Mason Pond Payroll Deductible (PRD1)",
                                                                        "Mason Pond Student (D1SA18)",
                                                                        "Shenandoah Evening (D2AE18)",
                                                                        "Shenandoah F/S (D2FA18)",
                                                                        "Shenandoah Payroll Deductible (PRD2)",
                                                                        "Shenandoah Student (D2SA18)",
                                                                        "Rappahannock F/S (D3FA18)",
                                                                        "Rappahannock Payroll Deductible (PRD3)",
                                                                        "Rappahannock Roof F/S (D3RO18)",
                                                                        "Rappahannock Student (D3SA18)",
                                                                        "Deck Motorcycle (DMBS18)",
                                                                        "F/S 9 Month (FF9M18)",
                                                                        "F/S Annual (FFA18)",
                                                                        "F/S Annual Sticker (FFAS18)",
                                                                        "F/S Semester (FFL18/FFG18)",
                                                                        "F/S Semester Sticker (FFLS18/FFGS18)",
                                                                        "(PRFF)",
                                                                        "Student 9 Month (FS9M18)",
                                                                        "Student Annual (FSA18)",
                                                                        "Student Annual Sticker (FSAS18)",
                                                                        "Student Semester (FSL18/FSG18)",
                                                                        "Student Semester Sticker (FSLS18/FSGS18)",
                                                                        "Global Center F/S (GCFA18)",
                                                                        "Global Center Student (GCSA18)",
                                                                        "Lot M & P Annual (LMP18)",
                                                                        "Lot M & P Semester (MPL18/MPG18)",
                                                                        "Motorcycle Surface (MB18)",
                                                                        "Lot I (RIA18)",
                                                                        "Lot J (RJA18)",
                                                                        "Resident Lite (RLA18)",
                                                                        "Lot R (RRA18)",
                                                                        "Service & Repair",
                                                                        "Surface Reserved (SS18)",
                                                                        "West Campus Annual (WC18)",
                                                                        "West Campus Semester (WCL18 WCG18)",
                                                                        "Foundation (FT18)",
                                                                        "VA Elected Officials (VSL18)",
                                                                        "Board of Visitors (BOV18)",
                                                                        "Daily General (DG18)",
                                                                        "Evening General (EG18)",
                                                                        "Weekly General (WG18)",
                                                                        "Monthly General (MG18)",
                                                                        "Field House Daily (MOPD18)",
                                                                        "Lot P Daily (LP18)",
                                                                        "Field House Weekly (MOPW)",
                                                                        "Field House Monthly (MOPM)",
                                                                        "West Campus Daily (WCD)",
                                                                        "West Campus Weekly (WCW)",
                                                                        "Lot L & K (LK18)",
                                                                        "Adjunct Lite (ADJ18)",
                                                                        "Weekend (WKND)",
                                                                        "(DP18)",
                                                                        "(DC18)",
                                                                        "RAC/AFC (TA18)",
                                                                        "Swim Team (TS18)",
                                                                        "Eagle Bank (EB18)",
                                                                        "FULL SET"),
                                                            
                                                            multiple = FALSE, selected = "Mason Pond Evening (D1AE18)", options = list(`actions-box` = TRUE,`none-selected-text` = "Nothing Selected",`live-search` = TRUE))),
                               
                               conditionalPanel("input.permit_or_visitor == 'Visitor'",
                                                
                                                pickerInput("visitor_type",label = "What type of parking are looking for?", choices = c("Option A","Option B","Option C","Option D"),
                                                            multiple = FALSE, selected = "Option A", options = list(`actions-box` = TRUE,`none-selected-text` = "Nothing Selected",`live-search` = TRUE))),
                               dataTableOutput("AAA"),
                     
                               br()
                               
                               ),
                  
                  column(width = 8, leafletOutput("MAP_EXAMPLE", height = "550")))
                
                



# Define server logic required to draw a histogram
server <- function(input, output) {
   
  
  output$MAP_EXAMPLE <- renderLeaflet({ 
    
    
  leaflet(options = leafletOptions(dragging = TRUE,
                                     minZoom = 15,
                                     maxZoom = 19)) %>%
      
    addProviderTiles("OpenStreetMap.BlackAndWhite") %>% 
      

    setView(lng = -77.314, lat = 38.8320, zoom = 15) %>%  #Complete Zoom Range ~[0:19]

      addResetMapButton() %>% 
  
      addLegend(title = "Can I park here?",
                position = "bottomleft",
                pal = pal_legend,
                values = legend_options,
                opacity = 1.0)
                               
                               })
  
  
  selected_mapping_permit_type <- reactive({
    
    switch(input$permit_type,
           
           "Mason Pond Evening (D1AE18)" = sf_Permit_D1AE18,
           "Mason Pond F/S (D1FA18)" = sf_Permit_D1FA18,
           "Mason Pond Payroll Deductible (PRD1)" = sf_Permit_PRD1,
           "Mason Pond Student (D1SA18)" = sf_Permit_D1SA18,
           "Shenandoah Evening (D2AE18)" = sf_Permit_D2AE18,
           "Shenandoah F/S (D2FA18)" = sf_Permit_D2FA18,
           "Shenandoah Payroll Deductible (PRD2)" = sf_Permit_PRD2,
           "Shenandoah Student (D2SA18)" = sf_Permit_D2SA18,
           "Rappahannock F/S (D3FA18)" = sf_Permit_D3FA18,
           "Rappahannock Payroll Deductible (PRD3)" = sf_Permit_PRD3,
           "Rappahannock Roof F/S (D3RO18)" = sf_Permit_D3RO18,
           "Rappahannock Student (D3SA18)" = sf_Permit_D3SA18,
           "Deck Motorcycle (DMBS18)" = sf_Permit_DMBS18,
           "F/S 9 Month (FF9M18)" = sf_Permit_FF9M18,
           "F/S Annual (FFA18)" = sf_Permit_FFA18,
           "F/S Annual Sticker (FFAS18)" = sf_Permit_FFAS18,
           "F/S Semester (FFL18/FFG18)" = sf_Permit_FFL18_FFG18,
           "F/S Semester Sticker (FFLS18/FFGS18)" = sf_Permit_FFLS18_FFGS18,
           "(PRFF)" = sf_Permit_PRFF,
           "Student 9 Month (FS9M18)" = sf_Permit_FS9M18,
           "Student Annual (FSA18)" = sf_Permit_FSA18,
           "Student Annual Sticker (FSAS18)" = sf_Permit_FSAS18,
           "Student Semester (FSL18/FSG18)" = sf_Permit_FSL18_FSG18,
           "Student Semester Sticker (FSLS18/FSGS18)" = sf_Permit_FSLS18_FSGS18,
           "Global Center F/S (GCFA18)" = sf_Permit_GCFA18,
           "Global Center Student (GCSA18)" = sf_Permit_GCSA18,
           "Lot M & P Annual (LMP18)" = sf_Permit_LMP18,
           "Lot M & P Semester (MPL18/MPG18)" = sf_Permit_MPL18_MPG18,
           "Motorcycle Surface (MB18)" = sf_Permit_MB18,
           "Lot I (RIA18)" = sf_Permit_RIA18,
           "Lot J (RJA18)" = sf_Permit_RJA18,
           "Resident Lite (RLA18)" = sf_Permit_RLA18,
           "Lot R (RRA18)" = sf_Permit_RRA18,
           "Service & Repair" = sf_SR18,
           "Surface Reserved (SS18)" = sf_SS18,
           "West Campus Annual (WC18)" = sf_WC18,
           "West Campus Semester (WCL18 WCG18)" = sf_WCL18_WCG18,
           "Foundation (FT18)" = sf_FT18,
           "VA Elected Officials (VSL18)" = sf_VSL18,
           "Board of Visitors (BOV18)" = sf_BOV18,
           "Daily General (DG18)" = sf_DG18,
           "Evening General (EG18)" = sf_EG18,
           "Weekly General (WG18)" = sf_WG18,
           "Monthly General (MG18)" = sf_MG18,
           "Field House Daily (MOPD18)" = sf_MOPD18,
           "Lot P Daily (LP18)" = sf_LP18,
           "Field House Weekly (MOPW)" = sf_MOPW,
           "Field House Monthly (MOPM)" = sf_MOPM,
           "West Campus Daily (WCD)" = sf_WCD,
           "West Campus Weekly (WCW)" = sf_WCW,
           "West Campus Monthly (WCM)" = sf_WCM,
           "Lot L & K (LK18)" = sf_LK18,
           "Adjunct Lite (ADJ18)" = sf_ADJ18,
           "Weekend (WKND)" = sf_WKND,
           "(DP18)" = sf_DP18,
           "(DC18)" = sf_DC18,
           "RAC/AFC (TA18)" = sf_TA18,
           "Swim Team (TS18)" = sf_TS18,
           "Eagle Bank (EB18)" = sf_EB18,
           "FULL SET" = sf_FULL_SET)
  
    
  })
  
  
    dynamic_marker_df <- reactive({
      
     current_selection_df <- selected_mapping_permit_type()
  
      selected_row_id <- input$AAA_rows_selected
      
      dynamic_marker_df <- current_selection_df[selected_row_id,]
      
      dynamic_marker_df
      
    })
  
  
  
  observe({

    leafletProxy("MAP_EXAMPLE", data = selected_mapping_permit_type()) %>%
      clearShapes() %>%
      addPolygons(label = ~Location,
                  color = ~Color,
                  weight = 2,
                  fillColor = ~Color,
                  fillOpacity = 0.35,
                  highlightOptions = highlightOptions(color = "black", weight = 2,
                                                      bringToFront = TRUE))
      
  })
  
  
  
  extract_marker_lng <- reactive({
    
    extract_marker_lng <- dynamic_marker_df()
    
    extract_marker_lng <- extract_marker_lng$Marker_Lng
    
  })
  
  
  extract_marker_lat <- reactive({
    
    extract_marker_lat <- dynamic_marker_df()
    
    extract_marker_lat <- extract_marker_lat$Marker_Lat
  
  })
  
  

observe({
  
  shift_map <- leafletProxy("MAP_EXAMPLE", data = dynamic_marker_df()) %>%
      clearMarkers() %>%
      addMarkers(lng = ~Marker_Lng,
                 lat = ~Marker_Lat,
                 popup = ~Location)
    
    
   shift_map %>%  setView(lng = extract_marker_lng(),
                          lat = extract_marker_lat(),
                          zoom = 17)
  shift_map
})




output$AAA  <-  renderDataTable({
  
  datatable(selected_mapping_permit_type(), rownames = FALSE,
            selection = "single",
            extensions = 'Scroller',
            options = list(pageLength = 100,
                           columnDefs = list(list(visible = FALSE,targets = c(2:5))),
                            scrollY = "325px",
                           scrollCollapse = TRUE,
                          dom = 't', ordering = FALSE))
  
})
  

}

# Run the application 
shinyApp(ui = ui, server = server)

Temporal solution is turning off package cache on your app's settings... see Shiny app no longer deploys (lwgeom)

1 Like

I purgted sf from the package cache, please try again.

1 Like

Thanks @fazepher and @josh for your assistance, the help is greatly appreciated and everything now works as intended.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.