Skip to content

Instantly share code, notes, and snippets.

@Jianghao
Created January 4, 2018 08:04
Show Gist options
  • Save Jianghao/3b66ee682f643605f1ebe18bec37bc4c to your computer and use it in GitHub Desktop.
Save Jianghao/3b66ee682f643605f1ebe18bec37bc4c to your computer and use it in GitHub Desktop.
# method 1
Sys.setlocale("LC_TIME", "C")
options(encoding = "gbk")
shp <- maptools::readShapePoly("**.shp")
proj4string <- CRS("+proj=longlat +datum=WGS84")
proj4string(shp) <- proj4string
# method 2
library(rgdal)
shp <- readOGR("**.shp", layer = "**", use_iconv = TRUE, encoding = "UTF-8")
@Jianghao
Copy link
Author

write_sf(obj = sf, dsn = dsn, layer_options = "ENCODING=GBK", driver = "ESRI Shapefile")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment