Calculates the extent of all input features in a FeatureCollection, and returns a bounding box. The returned bounding box is of the form (west, south, east, north).

lawn_extent(input, lint = FALSE)

Arguments

input

A data-Feature or data-FeatureCollection

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

Value

A bounding box, numeric vector of length 4, in [ minX, minY, maxX, maxY ] order

See also

Examples

# From a FeatureCollection cat(lawn_data$points_average)
#> {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"population":200},"geometry":{"type":"Point","coordinates":[10.724029,59.926807]}},{"type":"Feature","properties":{"population":600},"geometry":{"type":"Point","coordinates":[10.715789,59.904778]}},{"type":"Feature","properties":{"population":100},"geometry":{"type":"Point","coordinates":[10.746002,59.908566]}},{"type":"Feature","properties":{"population":200},"geometry":{"type":"Point","coordinates":[10.806427,59.90891]}},{"type":"Feature","properties":{"population":300},"geometry":{"type":"Point","coordinates":[10.79544,59.931624]}}]}
lawn_extent(lawn_data$points_average)
#> [1] 10.71579 59.90478 10.80643 59.93162
# From a Feature dat <- '{ "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [[ [-112.072391,46.586591], [-112.072391,46.61761], [-112.028102,46.61761], [-112.028102,46.586591], [-112.072391,46.586591] ]] } }' lawn_extent(dat)
#> [1] -112.07239 46.58659 -112.02810 46.61761