Skip to content

Allow support for sf through to meshbuilder #312

@sebsfox

Description

@sebsfox

Describe the bug
I had an sf object which I passed into the fdmr::mesh_builder() function, but I got the following error when the shiny app was loading:

test <- df |>
sf::st_as_sf() |>
sf::st_transform(sf::st_crs("+proj=longlat +datum=WGS84"))

fdmr::mesh_builder(
spatial_data = test,
x_coord = "long",
y_coord = "lat"
)
Warning in value[3L] :
Unable to read CRS from data, using default CRS = '+proj=longlat +datum=WGS84'

Listening on http://127.0.0.1:4044
Warning: Error in sf::st_sfc: use st_as_sfc() to extract geometries from an sf object
178: stop
177: sf::st_sfc
174: fm_unify_coords.sf
172: fmesher::fm_mesh_2d_inla
171: eventReactiveValueFunc
127: mesh
119:
103: mesh_spatial
98: ::
htmlwidgets
shinyRenderWidget
97: func
84: renderFunc
83: output$map
2: shiny::runApp
1: fdmr::mesh_builder

Expected behavior
I expected the shiny app to load my sf object with the expected mesh builder options

To Reproduce
See above

User Environment (please complete the following information):

─ Session info ──────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.3 (2024-02-29 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United Kingdom.utf8
 ctype    English_United Kingdom.utf8
 tz       Europe/London
 date     2024-03-26
 rstudio  2023.12.1+402 Ocean Storm (desktop)
 pandoc   3.1.1 @ C:/Users/Sebastian.Fox/AppData/Local/Programs/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────
 package           * version  date (UTC) lib source
 base64enc           0.1-3    2015-07-28 [1] CRAN (R 4.3.1)
 bslib               0.6.2    2024-03-22 [1] CRAN (R 4.3.3)
 cachem              1.0.8    2023-05-01 [1] CRAN (R 4.3.3)
 class               7.3-22   2023-05-03 [1] CRAN (R 4.3.3)
 classInt            0.4-10   2023-09-05 [1] CRAN (R 4.3.3)
 cli                 3.6.2    2023-12-11 [1] CRAN (R 4.3.3)
 codetools           0.2-19   2023-02-01 [1] CRAN (R 4.3.3)
 colorspace          2.1-0    2023-01-23 [1] CRAN (R 4.3.3)
 crayon              1.5.2    2022-09-29 [1] CRAN (R 4.3.3)
 crosstalk           1.2.1    2023-11-23 [1] CRAN (R 4.3.3)
 curl                5.2.1    2024-03-01 [1] CRAN (R 4.3.3)
 DBI                 1.2.2    2024-02-16 [1] CRAN (R 4.3.3)
 devtools            2.4.5    2022-10-11 [1] CRAN (R 4.3.3)
 digest              0.6.35   2024-03-11 [1] CRAN (R 4.3.3)
 dplyr             * 1.1.4    2023-11-17 [1] CRAN (R 4.3.3)
 e1071               1.7-14   2023-12-06 [1] CRAN (R 4.3.3)
 ellipsis            0.3.2    2021-04-29 [1] CRAN (R 4.3.3)
 evaluate            0.23     2023-11-01 [1] CRAN (R 4.3.3)
 fansi               1.0.6    2023-12-08 [1] CRAN (R 4.3.3)
 fastmap             1.1.1    2023-02-24 [1] CRAN (R 4.3.3)
 fdmr              * 0.2.0    2024-03-25 [1] Github (4DModeller/fdmr@6afa86c)
 fmesher             0.1.5    2023-12-20 [1] CRAN (R 4.3.3)
 fs                  1.6.3    2023-07-20 [1] CRAN (R 4.3.3)
 generics            0.1.3    2022-07-05 [1] CRAN (R 4.3.3)
 ggplot2             3.5.0    2024-02-23 [1] CRAN (R 4.3.3)
 glue                1.7.0    2024-01-09 [1] CRAN (R 4.3.3)
 gridExtra           2.3      2017-09-09 [1] CRAN (R 4.3.3)
 gtable              0.3.4    2023-08-21 [1] CRAN (R 4.3.3)
 htmltools           0.5.7    2023-11-03 [1] CRAN (R 4.3.3)
 htmlwidgets         1.6.4    2023-12-06 [1] CRAN (R 4.3.3)
 httpuv              1.6.14   2024-01-26 [1] CRAN (R 4.3.3)
 INLA                24.02.09 2024-02-09 [1] local
 jquerylib           0.1.4    2021-04-26 [1] CRAN (R 4.3.3)
 jsonlite            1.8.8    2023-12-04 [1] CRAN (R 4.3.3)
 KernSmooth          2.23-22  2023-07-10 [1] CRAN (R 4.3.3)
 knitr               1.45     2023-10-30 [1] CRAN (R 4.3.3)
 later               1.3.2    2023-12-06 [1] CRAN (R 4.3.3)
 lattice             0.22-5   2023-10-24 [1] CRAN (R 4.3.3)
 leafem              0.2.3    2023-09-17 [1] CRAN (R 4.3.3)
 leaflet             2.2.1    2023-11-13 [1] CRAN (R 4.3.3)
 leaflet.providers   2.0.0    2023-10-17 [1] CRAN (R 4.3.3)
 lifecycle           1.0.4    2023-11-07 [1] CRAN (R 4.3.3)
 magrittr            2.0.3    2022-03-30 [1] CRAN (R 4.3.3)
 mapview             2.11.2   2023-10-13 [1] CRAN (R 4.3.3)
 Matrix              1.6-5    2024-01-11 [1] CRAN (R 4.3.3)
 memoise             2.0.1    2021-11-26 [1] CRAN (R 4.3.3)
 mime                0.12     2021-09-28 [1] CRAN (R 4.3.1)
 miniUI              0.1.1.1  2018-05-18 [1] CRAN (R 4.3.3)
 munsell             0.5.0    2018-06-12 [1] CRAN (R 4.3.3)
 pillar              1.9.0    2023-03-22 [1] CRAN (R 4.3.3)
 pkgbuild            1.4.4    2024-03-17 [1] CRAN (R 4.3.3)
 pkgconfig           2.0.3    2019-09-22 [1] CRAN (R 4.3.3)
 pkgload             1.3.4    2024-01-16 [1] CRAN (R 4.3.3)
 png                 0.1-8    2022-11-29 [1] CRAN (R 4.3.1)
 profvis             0.3.8    2023-05-02 [1] CRAN (R 4.3.3)
 promises            1.2.1    2023-08-10 [1] CRAN (R 4.3.3)
 proxy               0.4-27   2022-06-09 [1] CRAN (R 4.3.3)
 purrr               1.0.2    2023-08-10 [1] CRAN (R 4.3.3)
 R6                  2.5.1    2021-08-19 [1] CRAN (R 4.3.3)
 raster              3.6-26   2023-10-14 [1] CRAN (R 4.3.3)
 RColorBrewer        1.1-3    2022-04-03 [1] CRAN (R 4.3.1)
 Rcpp                1.0.12   2024-01-09 [1] CRAN (R 4.3.3)
 remotes             2.5.0    2024-03-17 [1] CRAN (R 4.3.3)
 rlang               1.1.3    2024-01-10 [1] CRAN (R 4.3.3)
 rmarkdown           2.26     2024-03-05 [1] CRAN (R 4.3.3)
 rstudioapi          0.16.0   2024-03-24 [1] CRAN (R 4.3.3)
 sass                0.4.9    2024-03-15 [1] CRAN (R 4.3.3)
 satellite           1.0.5    2024-02-10 [1] CRAN (R 4.3.3)
 scales              1.3.0    2023-11-28 [1] CRAN (R 4.3.3)
 sessioninfo         1.2.2    2021-12-06 [1] CRAN (R 4.3.3)
 sf                  1.0-16   2024-03-24 [1] CRAN (R 4.3.3)
 shiny             * 1.8.0    2023-11-17 [1] CRAN (R 4.3.3)
 shinybusy           0.3.3    2024-03-09 [1] CRAN (R 4.3.3)
 shinyjs             2.1.0    2021-12-23 [1] CRAN (R 4.3.3)
 sp                  2.1-3    2024-01-30 [1] CRAN (R 4.3.3)
 stringi             1.8.3    2023-12-11 [1] CRAN (R 4.3.2)
 stringr             1.5.1    2023-11-14 [1] CRAN (R 4.3.3)
 terra               1.7-71   2024-01-31 [1] CRAN (R 4.3.3)
 tibble              3.2.1    2023-03-20 [1] CRAN (R 4.3.3)
 tidyselect          1.2.1    2024-03-11 [1] CRAN (R 4.3.3)
 units               0.8-5    2023-11-28 [1] CRAN (R 4.3.3)
 urlchecker          1.0.1    2021-11-30 [1] CRAN (R 4.3.3)
 usethis             2.2.3    2024-02-19 [1] CRAN (R 4.3.3)
 utf8                1.2.4    2023-10-22 [1] CRAN (R 4.3.3)
 vctrs               0.6.5    2023-12-01 [1] CRAN (R 4.3.3)
 withr               3.0.0    2024-01-16 [1] CRAN (R 4.3.3)
 xfun                0.43     2024-03-25 [1] CRAN (R 4.3.3)
 xtable              1.8-4    2019-04-21 [1] CRAN (R 4.3.3)
 yaml                2.3.8    2023-12-11 [1] CRAN (R 4.3.2)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions