Reputation: 1111
I have extracted values from raster layers and now want to convert it to shapefile. The csv file contains values of different bands and one column .geo in sf package. Any ideas to convert the csv file to shapefile in R.
library(sf)
# Read data file
LS2013<-read.csv("https://raw.githubusercontent.com/tuyenhavan/Rice-Paper/master/LS_2013.csv",header = T)
head(LS2013)
.geo
1 {"type":"Point","coordinates":[106.0283799940066,21.191342664375124]}
2 {"type":"Point","coordinates":[106.02664540369682,21.19108403651402]}
3 {"type":"Point","coordinates":[106.02693524526529,21.191084036514017]}
4 {"type":"Point","coordinates":[106.02722508683375,21.19107957741297]}
5 {"type":"Point","coordinates":[106.02751492840221,21.19107957741297]}
6 {"type":"Point","coordinates":[106.02780031086967,21.19107511831191]}
The shapefile can be in geographic coordinate system (4326).
Upvotes: 0
Views: 724
Reputation: 6226
It looks like the file is a JSON
or geoJSON
file. You can directly use sf::st_read
:
sf::st_read("https://raw.githubusercontent.com/tuyenhavan/Rice-Paper/master/LS_2013.csv", crs = 4326)
Upvotes: 1