[R] Re: Writing polyline shapefiles
Roger Bivand
Roger.Bivand at nhh.no
Wed Jul 28 16:27:09 CEST 2004
On Wed, 28 Jul 2004, Patrick Giraudoux wrote:
> Stephane, dear R listers,
>
> I wonder if the idea of developping some functions in R writing
> shapefiles from a matrix of coordinates -eg poly2shape()- is still with
> us? I currently manage with a home-made function writing an ASCII grass
> file, then importing it into GRASS as vector file, then exporting the
> vector file as a shapefile (ouf!). The main issue to me is still to be
> capable to wite the *.shx and *.shp from coordinates (the *.dbf is
> easier to manage, even indirectly, and can for instance be completed
> simply via Excel). I tried to open *.shp, etc.. files to understand how
> they were structured and thus write some programme by myself, but
> unsuccessfully (the way those files are coded is not ascii)
>
> Maptools is fantastic for importation and data handling within R, but
> unfortunately cannot export to shapefiles.
>
> Any news?
>
Nicholas Lewin-Koh wrote a simple sketch for type 1 (points) files
(undocumented C function "shpwrite"). Lines are probably less interesting,
so the polygon case remains. Is it important that the function pays close
attention to the shapefile specification (ring direction, etc., lakes and
islands) or can it assume that the user has everything under control? The
ESRI specification is clear enough, and the shapelib code is OK. The
longer term aim is to use the sourceforge "sp" package of spatial data
classes in S4 form to read and write SpatialDataFramePolygons, but I guess
doing a simpler function using S3 will get done sooner.
Roger
> Patrick Giraudoux
>
>
> PS: ESRI has managed to distribute ArcTools (with ArcGIS) with no way to
> importe generate ASCII formats!!! One must get ArcINFO for that... No
> comment!
>
>
>
--
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