R/geo-to-sf.R

Defines functions geo_to_sf.matrix geo_to_sf

Documented in geo_to_sf geo_to_sf.matrix

#' Parse centers / geo-coordinates to \code{sf} object.
#' @param latlng geo-coordinates
#' @name geo_to_sf
#' @export
geo_to_sf <- function(latlng) {
  UseMethod("geo_to_sf")
}

#' @name geo_to_sf
#' @export
geo_to_sf.matrix <- function(latlng) {
  as.data.frame(latlng) %>%
    sf::st_as_sf(coords = 2:1, crs = 4326)
}
crazycapivara/h3-r documentation built on Aug. 10, 2022, 1:17 p.m.