Last active
October 11, 2021 19:12
-
-
Save ajjitn/d299ad9f1c920b0f58aa7b973ea6997f to your computer and use it in GitHub Desktop.
Convert shapefile to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(tidyverse) | |
# Read in shapefile | |
geo_data <- st_read( | |
dsn = "/path/to/shapefile.shp" | |
) | |
# Write out as CSV with X,Y columns for lon/lat respectively | |
st_write(obj = geo_data, | |
dsn = "/path/to/output.csv", | |
layer_options = "GEOMETRY=AS_XY") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment