write-geojson
library(geojsonio)
library(sf)
# read geojson to sf
tmp <- geojsonio::geojson_read(file.path(in_path, layer4_name), what = "sp")
tmp2 <- st_as_sf(tmp)
# write GeoJSON - must transform from UTM to long/lat
st_write(st_transform(sf_mp,"+proj=longlat +datum=WGS84"),
paste0("sf_mp", ".geojson"),
driver = "GeoJSON",
delete_dsn = TRUE)
# read with sf package
layer5_name = "NoSprayInput.geojson"
layer5_path = "./devdata/"
gj_no_spray <- st_as_sf(
sf::st_read(
file.path(layer5_path, layer5_name),
stringsAsFactors = FALSE)
)