ropensci / ruODK

ruODK: An R Client for the ODK Central API
https://docs.ropensci.org/ruODK/
GNU General Public License v3.0
42 stars 13 forks source link

split_geoshape broken in ODKC > 1.1 #131

Closed florianm closed 3 years ago

florianm commented 3 years ago

Problem

split_geoshape fails to extract numeric coordinates of first point, while split_geotrace still works. This stems from a recent fix in ODK Central 1.2, which now exports valid GeoJSON Polygons: https://github.com/getodk/central-backend/issues/322

Reproducible example

# Failing tests
  expect_true(
    gj_first_gt %>% magrittr::extract2(geofield_lon) %>% is.numeric(),
    label = "split_geoshape casts extracted GeoJSON longitude to numeric"
  )
  expect_true(
    gj_first_gt %>% magrittr::extract2(geofield_lat) %>% is.numeric(),
    label = "split_geoshape casts extracted GeoJSON latitude to numeric"
  )
  expect_true(
    gj_first_gt %>% magrittr::extract2(geofield_alt) %>% is.numeric(),
    label = "split_geoshape casts extracted GeoJSON altitude to numeric"
  )

# This should be the numeric longitude
R> gj_first_gt %>% magrittr::extract2(geofield_lon)
[[1]]
[[1]][[1]]
[1] 115.8835

[[1]][[2]]
[1] -31.99697

[[1]][[3]]
[1] 0
Session Info ```{r} # utils::sessionInfo() ruODK_0.10.2.9002 ```