[R-sig-Geo] Error at reading shape file (readOGR())

Roger Bivand Roger.Bivand at nhh.no
Mon May 17 13:06:01 CEST 2010


On Mon, 17 May 2010, Agustin Lobo wrote:

>
> Solved: it was an accent, I just edited the name of the field with plugin
> Table manager in QGIS.
> Nevertheless, if QGIS can manage the file, why not R? should not be a matter
> of having
> an option for the charset?
> I tend to not to use non-ascii characters in files, but many agencies do.

Did you try any variant of the input_field_name_encoding= argument to 
ogrInfo() or readOGR()? Few data sources declare their encodings in a 
portable way, and OGR is not able to double-guess either, so will 
typically assume the locale of the machine on which it is running. If this 
is wrong, it sometimes has no safe fallback. Organisations often wrongly 
assume that files will only ever be used on the same platform in the same 
locale used to create them. Sometimes you can try ogrInfo() with different 
encoding settings until you find one that works. R has robust support for 
encoding, but does need clear knowledge of the encoding of the input.

Roger

>
> Thanks!
>
> Agus
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list