[R] Shapefiles
Roger Bivand
Roger.Bivand at nhh.no
Thu Feb 9 22:04:34 CET 2006
On Thu, 9 Feb 2006, Tarmo Remmel wrote:
> Dear List,
>
> I have examined the sp, maptools, and shapefiles packages (Windows) but
> cannot seem to figure out a solution for writing shapefiles for 'curvy
> shapes'. The scenario is that I generate a series of polygons, circles, and
> ellipses on a plot and would like to convert them to shapefiles. Since the
> circles and ellipses are do not return a coordinate list during the plotting
> sequence (e.g., all I need supply are the lengths of axes and rotation
> angle), is there an easy way by which the plot window can be converted to a
> shapefile?
No, the plot window is committed to the device, and (re)-capturing the
objects there as polygon objects will be messy. You'll need to generate an
object that can be drawn as a sequence of straight line segments, and
create a polygon object from that, from the x,y coordinates of the centre
and the radius, or major/minor axes lengths and orientations. There is
some code on:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/56190.html
(see RSiteSearch("circle"))
but I don't know if it will suit your purposes. Once constructed, the
polygons can be built into an object for exporting.
>
> Thank you,
>
> Tarmo
>
> __________________________________________
> Tarmo Remmel Ph.D.
> GUESS Lab, Department of Geography
> University of Toronto at Mississauga
> Mississauga, Ontario, L5L 1C6
> Tel: 905-569-4382
> Lab: 905-828-3868
> Fax: 905-828-5273
> Skype: tarmoremmel
> http://eratos.erin.utoronto.ca/remmelt
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
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-help
mailing list