lawn_random: Generate random data

View source: R/random.R

lawn_randomR Documentation

Generate random data

Description

Generates random data-GeoJSON data, including data-Point's and data-Polygon's, for testing and experimentation

Usage

lawn_random(
  type = "points",
  n = 10,
  bbox = NULL,
  num_vertices = 10,
  max_radial_length = 10,
  max_length = 1e-04,
  max_rotation = pi/8
)

Arguments

type

Type of features desired: 'position', 'points', 'polygons', or 'lines'

n

(integer) Number of features to generate.

bbox

A bounding box inside of which geometries are placed. In the case of Point features, they are guaranteed to be within this bounds, while Polygon features have their centroid within the bounds.

num_vertices

(numeric) the number of vertices added to polygon features. default: 10

max_radial_length

(numeric) The total number of decimal degrees longitude or latitude that a polygon can extent outwards to from its center. default: 10

max_length

(numeric) maximum number of decimal degrees that a vertex can be from its predecessor. default: 0.0001

max_rotation

(numeric) maximum number of radians that a line segment can turn from the previous segment. default: pi/8

Value

A data-FeatureCollection

See Also

Other data functions: lawn_featurecollection(), lawn_feature(), lawn_filter(), lawn_geometrycollection(), lawn_linestring(), lawn_multilinestring(), lawn_multipoint(), lawn_multipolygon(), lawn_point(), lawn_polygon(), lawn_remove(), lawn_sample()

Examples

## a position
lawn_random("position")
## set of points
lawn_random(n = 2)
lawn_random(n = 10)
## set of polygons
lawn_random('polygons', 2)
lawn_random('polygons', 10)
## set of lines
lawn_random('lines', 2)
lawn_random('lines', 10)
# with options
lawn_random(bbox = c(-70, 40, -60, 60))
lawn_random(num_vertices = 5)

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.