fakeRegions: Create fake geographic regions.

Description Usage Arguments Details Value Author(s) Examples

Description

Using an initial set of points, create some wiggly boundaries that look a bit like natural regional boundaries.

Usage

1
fakeRegions(n = 30, pts = cbind(runif(n), runif(n)), boundary = pts[chull(pts), ], clipmode = 0)

Arguments

n

The number of initial points. If only this argument is given, then n points on a unit square are the initial points.

pts

The initial seed points.

boundary

A boundary for clipping or cutting as a gpc.poly object.

clipmode

How to clip the polygons to the bounday. See details.

Details

The process is as follows. Create Voronoi tiles using the points as seeds. Take all the finite edges and wiggle them. Create polygons from those wiggly edges. Clip the polygons to the boundary polygon object.

If clipmode is 0, no clipping is done and all polygons are returned.

If clipmode = 1, any polygons that are partly within the boundary are returned.

If clipmode = 2, polygons are clipped to the boundary polygon.

If clipmode = 3, only polygons that are fully within the boundary are returned.

Value

A list with the following components:

polys

A list of GPC Polygon objects for the regions.

bounds

The clipping polygon used

points

The seed points used

box

The bounding box of the polygons

Author(s)

Barry Rowlingson

Examples

1
2
3
4
5
6
7
places = fakeRegions(clipmode=2)
## Not run:  plot(places$box,type="n")

## Not run: 
lapply(places$polys,function(x){plot(x,add=TRUE,poly.args=list(border="blue"))})

## End(Not run)

fakeplace documentation built on May 2, 2019, 4:43 p.m.