st_add_coordinates: Add coordinates as attributes to geospatial data

st_add_coordinatesR Documentation

Add coordinates as attributes to geospatial data

Description

Add coordinates as attributes to geospatial data.

Usage

st_add_coordinates(x, as_sf=FALSE, as_tibble=FALSE, rename=TRUE)

Arguments

x

sf object with point geometry

as_sf

flag for output as sf object. Default is TRUE.

as_tibble

flag for output as tibble. Default is TRUE.

rename

flag to rename output from X,Y to lon,lat. Default is TRUE.

Details

The sf::st_coordinates is applied to obtain the longitude and latitude coordinates.

Value

The longitude and latitude of the point geometry are added as attributes.

Examples

data(grevilleasf)
hakeoides <- dplyr::filter(grevilleasf, species=="hakeoides")
hakeoides_coord <- st_add_coordinates(hakeoides)

eks documentation built on May 29, 2024, 1:17 a.m.