Skip to content

Commit

Permalink
actually add the wk_writer() method
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jun 23, 2022
1 parent cad330d commit 057c026
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ S3method(wk_handle,s2_geography)
S3method(wk_is_geodesic,s2_geography)
S3method(wk_set_crs,s2_geography)
S3method(wk_set_geodesic,s2_geography)
S3method(wk_writer,s2_geography)
export(as_s2_cell)
export(as_s2_cell_union)
export(as_s2_geography)
Expand Down Expand Up @@ -200,4 +201,5 @@ importFrom(wk,wk_handle)
importFrom(wk,wk_is_geodesic)
importFrom(wk,wk_set_crs)
importFrom(wk,wk_set_geodesic)
importFrom(wk,wk_writer)
useDynLib(s2, .registration = TRUE)
8 changes: 8 additions & 0 deletions R/wk-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ s2_geography_writer <- function(oriented = FALSE, check = TRUE,
)
}

#' @rdname wk_handle.s2_geography
#' @importFrom wk wk_writer
#' @method wk_writer s2_geography
#' @export
wk_writer.s2_geography <- function(handleable, ...) {
s2_geography_writer()
}

#' @rdname wk_handle.s2_geography
#' @export
s2_trans_point <- function() {
Expand Down
3 changes: 3 additions & 0 deletions man/wk_handle.s2_geography.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/testthat/test-wk-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ test_that("wk_handle() for s2_geography works for s2_point projection", {
}
})

test_that("wk_writer() works for s2_geography()", {
expect_s3_class(wk::wk_writer(s2_geography()), "s2_geography_writer")
})

test_that("the s2_geography_writer() works for example WKT", {
# nc has some rings that get reordered by this operation
for (name in setdiff(names(s2_data_example_wkt), "nc")) {
Expand Down

0 comments on commit 057c026

Please sign in to comment.