Converts a HexData object to an sf spatial features object. Can create either point geometries (cell centers) or polygon geometries (cell boundaries).
Usage
as_sf(x, geometry = c("point", "polygon"), ...)Details
For point geometry, cell centers (cell_cen_lon, cell_cen_lat) are used. For polygon geometry, cell boundaries are computed using the grid specification.
Examples
if (FALSE) { # \dontrun{
result <- hexify(df, lon = "lon", lat = "lat", area_km2 = 1000)
# Get sf points
sf_pts <- as_sf(result)
# Get sf polygons
sf_poly <- as_sf(result, geometry = "polygon")
} # }