inst/tinytest/test_vect-geom.R

f <- system.file("ex/lux.shp", package="terra")
lux <- vect(f)

listofraw <- geom(lux[1:2, ], wkb = TRUE)
wkb <- listofraw[[1]]

expect_equal(vect(listofraw, type = NULL, crs = crs(lux)), lux[1:2, 0])

hex <- geom(lux[1, ], hex = TRUE)

expect_equal(typeof(listofraw), "list") 
expect_equal(typeof(wkb), "raw")

expect_equal(tolower(paste0(as.character(wkb), collapse = "")), tolower(hex))

Try the terra package in your browser

Any scripts or data that you put into this service are public.

terra documentation built on Jan. 12, 2026, 9:07 a.m.