R/as_wkb_list.R

Defines functions as_wkb_list.geos_geometry as_wkb_list.sfc as_wkb_list.wk_wkb as_wkb_list.blob as_wkb_list.list as_wkb_list

# Internal generic: convert geometry input to a wk_wkb vector.
# Methods handle sf (sfc), geos, wk_wkb, blob, and raw-list input.

as_wkb_list <- function(x) {
  UseMethod("as_wkb_list")
}

#' @export
as_wkb_list.list <- function(x) {
  stopifnot(all(vapply(x, is.raw, logical(1))))
  wk::wkb(x)
}

#' @export
as_wkb_list.blob <- function(x) {
  wk::wkb(x)
}

#' @export
as_wkb_list.wk_wkb <- function(x) {
  x
}

#' @export
as_wkb_list.sfc <- function(x) {
  wk::as_wkb(x)
}

#' @export
as_wkb_list.geos_geometry <- function(x) {
  wk::as_wkb(x)
}

Try the controlledburn package in your browser

Any scripts or data that you put into this service are public.

controlledburn documentation built on Oct. 28, 2026, 5:12 p.m.