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

Support geotrace and geoshape parsing for ODK Central v 0.7 #70

Closed florianm closed 4 years ago

florianm commented 4 years ago

Feature

ODK Central v0.7 and lower ignore the WKT argument for geotrace and geoshape and return the same "ODK linestring" format.

v7wkt <- ruODK::odata_submission_get(wkt = TRUE, parse = TRUE)

v7gj <- ruODK::odata_submission_get(wkt = FALSE, parse = FALSE) %>%
  ruODK::odata_submission_rectangle()

v7ls <- "-14.80 128.40 10.9 5.9;-14.81 128.41 1.7 1.9;-14.82 128.42 1.9 1.7;"

split_geotrace should be able to extract lat, lon, alt, acc from the ODKC v7 linestring. Currently, odata_submission_get() fails to parse ODKC v7 linestrings.

Using the R package wastdr, we can (a bit tediously) run:

ruODK::odata_submission_get(wkt = FALSE, parse = FALSE) %>%
  ruODK::odata_submission_rectangle() %>%
      dplyr::mutate(
        tx = purrr::map(LINESTRING_COLNAME, wastdr::gj_linestring_to_st_linestring)
      ) %>%
      sf::st_as_sf(crs = "WGS84") %>%
      sf::st_zm()