poly2SpatialPolygons {hero}R Documentation

Convert simple polygon to a SpatialPolygons object

Description

This function takes a simple polygon and attempts to convert it to a SpatialPolygons object. This list is assumed to have components x and y that define the boundary of the polygon.

Usage

poly2SpatialPolygons(x, ID = "border")

Arguments

x

A list with components x and y.

ID

The name of the resulting polygon. Default is "border".

Value

A SpatialPolygons object

Author(s)

Joshua French

Examples

angle = seq(0, 2 * pi, len = 100)
poly = list(x = cos(angle), y = sin(angle))
plot(poly, type = "l", asp = 1)
sppoly = poly2SpatialPolygons(poly)
library(sp)
plot(sppoly, axes = TRUE, asp = 1)

[Package hero version 0.6 Index]