Learn R Programming

lawn (version 0.6.0)

lawn_square: Calculate a square bounding box

Description

Takes a bounding box and calculates the minimum square bounding box that would contain the input.

Usage

lawn_square(bbox)

Arguments

bbox

A bounding box.

Value

A square surrounding bbox, numeric vector of length four.

See Also

Other measurements: lawn_along(), lawn_area(), lawn_bbox_polygon(), lawn_bbox(), lawn_bearing(), lawn_center_of_mass(), lawn_center(), lawn_centroid(), lawn_destination(), lawn_distance(), lawn_envelope(), lawn_extent(), lawn_line_distance(), lawn_midpoint(), lawn_point_on_feature(), lawn_pt2line_distance()

Examples

Run this code
# NOT RUN {
bbox <- c(-20, -20, -15, 0)
lawn_square(bbox)
# }
# NOT RUN {
sq <- lawn_square(bbox)
lawn_featurecollection(list(lawn_bbox_polygon(bbox),
  lawn_bbox_polygon(sq))) %>% view
# }

Run the code above in your browser using DataLab