读写geojson和shp文件
library(sf)
library(tidyverse)
读写geojson
shi <- st_read("C:\\Users\\ruiying\\Desktop\\shi.geojson")
st_write(shi, "C:\\Users\\ruiying\\Desktop\\shi2.geojson",append=F)
读写json
weihai <- st_read("D:\\使用GEOJSON数据绘制地图\\威海市.json")
st_write(weihai %>% select(name,adcode),"C:\\Users\\ruiying\\Desktop\\weihai.geojson")
st_write(meuse_sf,"weihai.shp")
st_write(meuse_sf,"weihai.geojson",append = F)
st_write(meuse_sf,"weihai.json",driver = 'GeoJSON',append = F)
st_write(meuse_sf,"weihai.gpkg",append = F)
test <- st_read('C:\\Users\\ruiying\\Desktop\\shi.geojson')
评论
发表评论