Re: [R] Shapefiles

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Fri 10 Feb 2006 - 08:04:34 EST


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@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@nhh.no

______________________________________________
R-help@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
Received on Fri Feb 10 09:32:43 2006

This archive was generated by hypermail 2.1.8 : Sat 11 Feb 2006 - 03:09:04 EST