Description Usage Arguments Value Examples
Transform coordinates using R functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | crs_engine_fun(prepare = wk::wk_crs_proj_definition)
crs_engine_fun_define(engine, crs_to, crs_from, fun)
crs_engine_fun_get(engine, crs_to, crs_from)
crs_transform_fun(
handleable,
fun,
strategy = wk::wk_chunk_strategy_coordinates(chunk_size = 65536)
)
## S3 method for class 'crs2crs_engine_fun'
crs_engine_get_wk_trans(engine, handleable, crs_to, crs_from, ...)
|
prepare |
A function that converts CRS objects to a canonical string
definition. This reduces the number of function definitions that might
otherwise be required to capture the transforms. The default is to
use |
engine |
A |
crs_to |
Source and destination coordinate reference systems |
crs_from |
Source and destination coordinate reference systems |
fun |
A function that accepts the output of |
handleable |
A geometry vector (e.g., |
strategy |
A function of |
... |
engine-specific transformation options |
crs_engine_fun()
: An engine that can be used for transforms
crs_engine_fun_define()
: Returns engine
, modified mutably
crs_engine_fun_get()
: A function()
that accepts a single argument
that is the output of wk::wk_coords()
.
crs_transform_fun()
: Returns a modified handleable
with fun
applied
to the coordinates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | engine <- crs_engine_fun()
engine <- crs_engine_fun_define(engine, "EPSG:3857", "OGC:CRS84", function(coords) {
r <- 6378137
coords$x <- coords$x * pi / 180 * r
coords$y <- log(tan(pi / 4 + coords$y * pi / 180 / 2)) * r
coords
})
crs_transform(
wk::xy(-64, 45, crs = "OGC:CRS84"),
"EPSG:3857",
engine = engine
)
# can also use a function to apply a generic transform
crs_transform_fun(wk::xy(1, 2), function(coords) {
coords$x <- coords$x * 2
coords$y <- coords$y * 2
coords
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.