【R】readOGR读取shp,中文乱码,解决办法
(2017-09-22 17:09:09)
标签:
r |
分类: 技术 |
网上有的说需要如下设置:
setCPLConfigOption("SHAPE_ENCODING","")
我这里没有效果
我用的版本:
rgdal: version: 1.2-11, (SVN revision 676)
解决方案:
poi <- readOGR(dsn, layer, use_iconv = TRUE, encoding = "UTF-8")
只设置encoding是没有用的,因为:
The encoding-parameter is ignored, if iconv is not set to TRUE.
官方文档说明
encoding:
setCPLConfigOption("SHAPE_ENCODING","")
我这里没有效果
我用的版本:
rgdal: version: 1.2-11, (SVN revision 676)
解决方案:
poi <- readOGR(dsn, layer, use_iconv = TRUE, encoding = "UTF-8")
只设置encoding是没有用的,因为:
The encoding-parameter is ignored, if iconv is not set to TRUE.
官方文档说明
default NULL, if set to a character string, and the driver is
“ESRI Shapefile”, and use_iconv is FALSE, it is passed to the CPL
Option “SHAPE_ENCODING” immediately before reading the DBF of a
shapefile. If use_iconv is TRUE, and encoding is not NULL, it
will be used to convert input strings from the given value to the
native encoding for the system/platform.
前一篇:conda 安装python包