Skip to contents

This function takes an sf object and converts it to a data frame, adding "POINT_X" and "POINT_Y" columns for longitude and latitude. If the input sf object is not in WGS 84, it will be transformed.

Usage

sf_to_df_with_coords(sf_object)

Arguments

sf_object

An sf object with POINT geometry

Value

A data frame with all original columns plus POINT_X and POINT_Y in WGS 84 CRS.

Examples

if (FALSE) { # \dontrun{
library(sf)
# Assuming 'sampled_plots$non_deforested_plots' is your sf object
df <- sf_to_df_with_coords(sampled_plots$non_deforested_plots)
} # }