Closed AmyMikhail closed 1 year ago
Solution from Lucca Nielsen:
The issue is that file_selected()
could be empty when the event was triggered, and the code didn’t handle this situation properly.
To fix this error, we need to ensure that file_selected()
is not empty before trying to access its elements.
user_shp <- eventReactive(input$addshapefile, {
if (!is.null(file_selected()) &&
nrow(file_selected()) > 0 &&
file.exists(file_selected()$datapath)) {
sf::st_read(dsn = file_selected()$datapath)
} else {
NULL
}
})
Problem statement:
When the app is launched and the button to include region borders is ticked, the second button to browse for the location of shapefiles is shown. However, when that button is clicked, the browser window fails to show, the app aborts and the following warning is shown in the R console:
Further details:
It is noteworthy that this warning is appearing three times... not really clear why this error is occuring, needs more debugging.
See image below: