Reputation: 982
Hangul (Korean) script in shapefiles gets mangled in the process of reading into R.
Download Seoul, Incheon, Gyeonggi-do region shapefiles from this website (in Korean). I attach the files, as they are not accessible outside Korea.
I'm using RStudio on Windows 10 in English. Just in case, set RStudio default text encoding to "UTF-8" and set locale to Korean:
Sys.setlocale(category="LC_ALL", locale = "Korean")
Read shapefiles into R using the sf
package:
library(sf)
#Read, name and combine regions
sca_nsdi <- rbind(cbind(st_read("LARD_ADM_SECT_SGG_11.shp"), Name="Seoul"),
cbind(st_read("LARD_ADM_SECT_SGG_28.shp"), Name="Incheon"),
cbind(st_read("LARD_ADM_SECT_SGG_41.shp"), Name="Gyeonggi-do"))
#View result
View(sca_nsdi)
The hangul in column SGG_NM
is unreadable, as well as through the console:
sca_nsdi$SGG_NM[1]
[1] ������
Upvotes: 1
Views: 365
Reputation: 982
I've finally just figured it out:
Sys.setlocale(category="LC_ALL", locale = "Korean")
sca_nsdi <- rbind(cbind(st_read("LARD_ADM_SECT_SGG_11.shp", options="ENCODING=EUC-KR"), Name="Seoul"),
cbind(st_read("LARD_ADM_SECT_SGG_28.shp", options="ENCODING=EUC-KR"), Name="Incheon"),
cbind(st_read("LARD_ADM_SECT_SGG_41.shp", options="ENCODING=EUC-KR"), Name="Gyeonggi-do"))
Upvotes: 1