Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

locatePolys

Locate Polygons on the Current Plot


Description

Locate polygons on the current plot (using the locator function).

Usage

locatePolys (pdata, n = 512, type = "o", ...)

Arguments

pdata

PolyData (optional) with columns PID and SID (optional), with two more optional columns n and type.

n

maximum number of points to locate.

type

one of "n", "p", "l", or "o". If "p" or "o", then the points are plotted; if "l" or "o", then the points are joined by lines.

...

additional par parameters for the locator function.

Details

This function allows its user to define polygons with mouse clicks on the current plot via the locator function. The arguments n and type are the usual parameters for the locator function, but the user can specify them for each individual (PID, SID) in a pdata object.

If a pdata object exists, the function ignores columns other than PID, SID, n, and type. If pdata includes n, then an outer boundary has n > 0 and an inner boundary has n < 0.

On exit from locator, suppose the user defined m vertices for a given polygon. For that polygon, the X and Y columns will contain NAs where POS = (m+1):n for outer-boundaries and POS = (|n|-m):1 for inner-boundaries. The na.omit function can remove rows with NAs.

If a pdata object does not exist, the output contains only one polygon with a PID equal to 1. One inner-boundary polygon (POS goes from n to 1) can be generated by supplying a negative n.

If type = "o" or type = "l", the function draws a line connecting the last and first vertices.

Value

PolySet with projection attribute equal to the map's projection. The function does not set the zone attribute.

Author(s)

Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2007-06-06

See Also

Examples

#--- define one polygon with up to 5 vertices on the current plot
## Not run: polys <- locatePolys(n = 5)

PBSmapping

Mapping Fisheries Data and Spatial Analysis Tools

v2.73.0
GPL (>= 2)
Authors
Jon T. Schnute [aut], Nicholas Boers [aut], Rowan Haigh [aut, cre], Alex Couture-Beil [ctb], Denis Chabot [ctb], Chris Grandin [ctb], Angus Johnson [ctb], Paul Wessel [ctb], Franklin Antonio [ctb], Nicholas J. Lewin-Koh [ctb], Roger Bivand [ctb]
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.