0

I am reading a shp file in R but it contains Greek letters which I can not read

library(rgdal)

shpFile <- readOGR(dsn = getwd() , layer = "FileName")
shpFile$names

Gives as a result the following

# [1] \xc2\xe1\xf3\xe9\xeb\xdf\xf3\xe7\xf2 \xd3\xef\xf6\xdf\xe1\xf2

I tried to change the Locate and reopen with encoding UTF-8, which works pretty fine if you have excel files, but it didn't work.

I also tried:

shpFile <- readOGR(dsn = getwd() , layer = "FileName", encoding = "UTF-8")

Thank you for any hints or points in the right direction you can give!

Phil
  • 4,344
  • 2
  • 23
  • 33
kaza
  • 1
  • 2
  • Are the Greek characters in the filename or in the file itself? If it's the former I don't think `gdal` (which is doing the work for `rgdal`) supports non-ASCII filenames. – Phil May 17 '17 at 13:58
  • The Greek characters are in the file – kaza May 17 '17 at 14:12
  • They're probably in the `.dbf` file which you can just open with Excel or LibreOffice and remove the affected characters. For an R solution have a look here: http://stackoverflow.com/questions/9934856/removing-non-ascii-characters-from-data-files – Phil May 17 '17 at 14:38

0 Answers0