On Tue, 18 May 2010, Daniel wrote:

Hello all,
I have had a incovenient trouble to read a shapefile that I suspect
was encoded as "latin-1". Since I'm mac user and mac uses UTF-8, some
kind of problem could be happen.
I tryed some comand lines without success:

brasil <- readShapeSpatial(file.choose(),
proj4string=CRS("+proj=longlat"))
Error in getinfo.shape(fn) : Error opening SHP file

brasil <- readShapePoly("/Users/daniel/bases/maps/Brasil/55mu2500gsr.shp", 
encoding="latin1")
Error in readShapePoly("/Users/daniel/bases/maps/Brasil/55mu2500gsr.shp",  :
  unused argument(s) (encoding = "latin1")

Somebody know how can I open it?

Please do read the error messages, and do not jump to conclusions. Always examine the output of traceback() after an error. In the first case, you do not show the file name, nor have you tried list.files() to show that the file is where you think it is (it doesn't seem to be there). In the second case, as the error message says, there is no encoding= argument to readShape*() - does it say there is on the help page?

Are you refering to the field names in the DBF, or to the contents of the fields? Can you read the DBF file itself with read.dbf() in the foreign package (used in maptools)? So far, you have not established that your beliefs about the encoding are the problem here.

If the issue is in the field names, have you tried readOGR() in rgdal, which does have an argument for setting the encoding of field names? If you feel that rgdal is not available for OSX, I can with pleasure thank Brian Ripley for making both 32-bit and 64-bit Intel versions available on CRAN extras - use:

setRepositories(ind=1:2)
install.packages('rgdal')

Roger


Daniel

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
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.biv...@nhh.no
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to