R/compat-sf.R

Defines functions st_as_sf.geos_geometry st_as_sfc.geos_geometry

# dynamically exported
st_as_sfc.geos_geometry <- function(x, ...) {
  sfc <- wk::wk_handle(x, wk::sfc_writer())
  sf::st_crs(sfc) <- sf::st_crs(attr(x, "crs", exact = TRUE))
  sfc
}

st_as_sf.geos_geometry <- function(x, ...) {
  sf::st_as_sf(
    new_data_frame(
      list(geometry = st_as_sfc.geos_geometry(x))
    )
  )
}

Try the geos package in your browser

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

geos documentation built on June 7, 2023, 6:04 p.m.