as_extent {arcgisutils} | R Documentation |
Convert an object to an extent
Description
Given an sf or sfc object create a list that represents the extent of the
object. The result of this function can be parsed directly into json using
jsonify::to_json(x, unbox = TRUE)
or included into a list as the extent
component that will be eventually converted into json using the above function.
Usage
as_extent(x, crs = sf::st_crs(x), call = rlang::caller_env())
Arguments
x |
an sf or sfc object |
crs |
the CRS of the object. Must be parsable by |
call |
The execution environment of a currently running
function, e.g. You only need to supply Can also be For more information about error calls, see Including function calls in error messages. |
Value
An extent json object. Use jsonify::to_json(x, unbox = TRUE)
to convert
to json.
Examples
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
as_extent(nc)