[R] Re: maptools, filename writing shapefiles

Roger Bivand Roger.Bivand at nhh.no
Sat Mar 5 19:52:37 CET 2005


On Sat, 5 Mar 2005, Patrick Giraudoux H wrote:

> Hi,
> 
> I meet a strange trouble writing shapefiles with write.pointShape() from 
> maptools.
> 
>  > write.pointShape(mylines[,5:9], file="Sxtplinshp", mycoordspt)
> Error in write.pointShape(mylines[, 5:9], file = "Sxtplinshp", mycoordspt) :
>          shapefile names must conform to the 8.3 format
> 
> It seems that the function request a special shapefile name spelling 
> (conformed to 8.3 ESRI format?).
> 
>  > write.pointShape(mylines[,5:9], file="Sxtplin", mycoordspt)
> 
> When just shortened, everything goes smoothly with the file correctly written.
> 
> I am not sure about ESRI standard requesting short names (modifying the 
> filename by hand keep it readable by any GIS).

Well, the ESRI technical description - access also at:

http://dl.maptools.org/dl/shapelib/shapefile.pdf

says (p. 6): "All file names adhere to the 8.3 naming convention. The main
file, the index file, and the dBASE file have the same prefix. The prefix
must start with an alphanumeric character (aZ, 09), followed by zero or up
to seven characters (aZ, 09, _, -). The suffix for the main file is .shp.
The suffix for the index file is .shx. The suffix for the dBASE table is
.dbf."

so maptools tries to follow the standard. It doesn't actually try hard
enough, because the same paragraph continues: "All letters in a file name
are in lower case on operating systems with case sensitive file names". So
I guess tolower() will have to be used too! The white paper is dated 1998,
by the way. A possible change in maptools would be to add a
strictFilename=FALSE argument, so that users can "adhere" to ESRI's
standards (as were) if they are still running ArcView on Windows 3.*; this
will probably be in the next (> 0.4-13) version, since there do not seem
to be any limitations in the shapelib code.

Roger

> 
> Can anybody (especially Roger...) tell us where comes the trouble from?
> 
> Patrick Giraudoux
> 
> 
> 
> 
> 

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




More information about the R-help mailing list