[R-sig-Geo] to many characters in .dbf file?

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 18 20:27:39 CET 2010

On Thu, 18 Mar 2010, Michael Denslow wrote:

> Dear r-sig-geo,
> I am in a bit of a bind. I am trying to write a shape file using 
> writeOGR() in rgdal. I just realized that I may have too many characters 
> in the cells as they are getting cut off when the shape file is created. 
> The cells are unchanged in the SpatialPointsDataFrame. But when I 
> inspect the .dbf they are all truncated. The cells that are cut off 
> contain literature citations, so some are very long (hundreds of 
> characters). Is there a solution to this problem? This shape file is 
> being imported into Geoserver so I am some what limited as to the 
> formats that I can use.

The OGR driver truncates (I think to 254 characters), so use 
writeSpatialShape() in maptools instead, passing your large number through 
the max_nchar= argument. Please read the details in ?write.dbf - field 
widths above 254 are not portable.


> Any advice?
> Thanks in advance,
> Michael

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