powered by
Add coordinates as attributes to geospatial data.
st_add_coordinates(x, as_sf=FALSE, as_tibble=FALSE, rename=TRUE)
The longitude and latitude of the point geometry are added as attributes.
sf object with point geometry
sf
flag for output as sf object. Default is TRUE.
flag for output as tibble. Default is TRUE.
flag to rename output from X,Y to lon,lat. Default is TRUE.
X,Y
lon,lat
The sf::st_coordinates is applied to obtain the longitude and latitude coordinates.
sf::st_coordinates
data(grevilleasf) hakeoides <- dplyr::filter(grevilleasf, species=="hakeoides") hakeoides_coord <- st_add_coordinates(hakeoides)
Run the code above in your browser using DataLab