Convert a lon/lat or lat/lon coordinate pair to a sfc object
Source:R/lonlat_to_sfc.R
lonlat_to_sfc.Rd
Usage
lonlat_to_sfc(
x,
range = getOption("sfext.coord_range", c(xmin = -180, ymin = -50, xmax = 180, ymax =
60)),
quiet = FALSE,
call = parent.frame(),
...
)
Arguments
- x
A length 2 numeric vector with geodetic coordinates in a EPSG:4326 coordinate reference system.
- range
For
lonlat_to_sfc()
, an object that is coercible to abbox
object or a length 4 vector with names xmin, xmax, ymin, and ymax. If a coordinate pair falls outside the latitude/longitude range defined by the vector but inside the range if reversed, the coordinates are assumed to be in lat/lon order and are switched to lon/lat order before being converted to a point. Defaults toc("xmin" = -180, "ymin" = -50, "xmax" = 180, "ymax" = 60)
. Note that this default setting will reverse valid coordinates north of Anchorage, Alaska or south of New Zealand.- quiet
If
TRUE
, suppress alert messages when converting a lat/lon coordinate pair to a lon/lat pair. Defaults toFALSE
.- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.- ...
Arguments passed on to
sf::st_sfc
precision
numeric; see st_as_binary
check_ring_dir
see st_read
dim
character; if this function is called without valid geometries, this argument may carry the right dimension to set empty geometries
recompute_bbox
logical; use
TRUE
to force recomputation of the bounding box