tests/dist.R

suppressPackageStartupMessages(library(sf))
library(sp)
suppressPackageStartupMessages(library(units))
library(geosphere)

x = st_sfc(
st_point(c(0,0)),
st_point(c(1,0)),
st_point(c(2,0)),
st_point(c(3,0)),
crs = 4326
)

y = st_sfc(
st_point(c(0,10)),
st_point(c(1,0)),
st_point(c(2,0)),
st_point(c(3,0)),
st_point(c(4,0)),
crs = 4326
)

st_crs(y) = 4326
st_crs(x) = 4326
sf_use_s2(FALSE)
(d.sf = st_distance(x, y))
r-spatial/lwgeom documentation built on June 5, 2024, 1:20 a.m.