[R-sig-Geo] readOGR and nonASCII character

Agustin Lobo Agustin.Lobo at ija.csic.es
Mon Jul 23 08:32:36 CEST 2007


Roger,

read.shapefile() and read.dbf() yields weird symbols for non-ascii 
characters in the input file also.
Exporting to csv and reading in with read.csv(filename,sep=";") works 
fine (yes, it's odd, excel puts ";" instead of "," for CSV in spanish 
locale as
"," could be used for decimal separation)

My session.info output is:

 > sessionInfo()
R version 2.5.0 (2007-04-23)
i386-pc-mingw32

locale:
LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
"methods"   "base"

other attached packages:
   spatstat       mgcv shapefiles   maptools    foreign      rgdal 
    sp
   "1.11-7"   "1.3-23"      "0.6"   "0.6-13"   "0.8-20"   "0.5-13" 
"0.9-14"

Agus

Roger Bivand escribió:
> On Wed, 11 Jul 2007, Agustin Lobo wrote:
> 
>> Hi list,
>>
>> Is there any way to get readOGR() to correctly read
>> non-ascii character strings from the dbf file? I've
>> checked and my dbf file correctly displays
>> names with accents, but once read into R
>> accents are substituted by wrong symbols.
> 
> We are dependent on what GDAL/OGR gives us here. Please try the 
> equivalent function in maptools for your shapefile, and see whether the 
> read.dbf() in foreign does any better. I'm assuming that you know the 
> locale settings of your platform, and of the originating platform from 
> sessionInfo()?
> 
> Roger
> 
>>
>> Agus
>>
>>
> 

-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster




More information about the R-sig-Geo mailing list