editor Module in demo example fails in mapedit 0.6.0 but works in 0.5.0
leungi opened this issue · comments
Reprex below.
library(mapedit)
library(mapview)
library(shiny)
# make the coordinates a numeric matrix
qk_mx <- data.matrix(quakes[, 2:1])
# convert the coordinates to a multipoint feature
qk_mp <- st_multipoint(qk_mx)
# convert the multipoint feature to sf
qk_sf <- st_sf(st_cast(st_sfc(qk_mp), "POINT"), quakes, crs = 4326)
ui <- fluidPage(
fluidRow(
# edit module ui
column(6, editModUI("editor")),
column(
6,
h3("Boxplot of Depth"),
plotOutput("selectstat")
)
)
)
server <- function(input, output, session) {
# edit module returns sf
edits <- callModule(editMod, "editor", mapview(qk_sf)@map)
output$selectstat <- renderPlot({
req(edits()$finished)
qk_intersect <- st_intersection(edits()$finished, qk_sf)
req(nrow(qk_intersect) > 0)
boxplot(
list(
all = as.numeric(qk_sf$depth),
selected = as.numeric(qk_intersect$depth)
),
xlab = "depth"
)
})
}
shinyApp(ui, server)
Error Msg
Error: (converted from warning) Error in : (converted from warning)
Session
- Session info ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.6.2 (2019-12-12)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/Chicago
date 2020-03-26
> packageVersion("mapedit")
[1] ‘0.6.0’
> packageVersion("mapview")
[1] ‘2.7.0’
> packageVersion("leaflet")
[1] ‘2.0.3’
@leungi is this resolved in 0.6.1
for you? Would it be possible to try remotes::install_github("r-spatial/mapedit")
? Thanks.
Keeping all packages, other than mapedit
as before; works as designed 🙌
Thanks @timelyportfolio 🙏
> packageVersion("mapedit")
[1] ‘0.6.1’
> packageVersion("mapview")
[1] ‘2.7.0’
> packageVersion("leaflet")
[1] ‘2.0.3’