# Generated by fusen: do not edit by hand
library(dplyr)
test_that("crop_transect works", {
expect_true(inherits(crop_transect, "function"))
})
test_that("test conformite crop_transect", {
data("dataset_transects")
data("dataset_map")
test <- dataset_transects %>%
crop_transect(map_obj = dataset_map) %>%
slice(1:5)
exp <- structure(list(transect = 2:6, geometry = structure(list(structure(c(-142908.096536355,
-140390.409885506, 6279043.1524534, 6277376.20458493), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-140390.409885506,
-148631.779514982, 6274935.65583958, 6279043.1524534), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-151889.144150109,
-140390.409885506, 6279043.1524534, 6271429.89741783), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-140390.409885506,
-154390.409885506, 6269395.91642389, 6276373.51301024), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg")), structure(c(-154390.409885506,
-140390.409885506, 6274752.92094795, 6265483.59025074), .Dim = c(2L,
2L), class = c("XY", "LINESTRING", "sfg"))), class = c("sfc_LINESTRING",
"sfc"), precision = 0, bbox = structure(c(xmin = -154390.409885506,
ymin = 6265483.59025074, xmax = -140390.409885506, ymax = 6279043.1524534
), class = "bbox"), crs = structure(list(input = "EPSG:2154",
wkt = "PROJCRS[\"RGF93 / Lambert-93\",\n BASEGEOGCRS[\"RGF93\",\n DATUM[\"Reseau Geodesique Francais 1993\",\n ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4171]],\n CONVERSION[\"Lambert-93\",\n METHOD[\"Lambert Conic Conformal (2SP)\",\n ID[\"EPSG\",9802]],\n PARAMETER[\"Latitude of false origin\",46.5,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8821]],\n PARAMETER[\"Longitude of false origin\",3,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8822]],\n PARAMETER[\"Latitude of 1st standard parallel\",49,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8823]],\n PARAMETER[\"Latitude of 2nd standard parallel\",44,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8824]],\n PARAMETER[\"Easting at false origin\",700000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8826]],\n PARAMETER[\"Northing at false origin\",6600000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8827]]],\n CS[Cartesian,2],\n AXIS[\"easting (X)\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1]],\n AXIS[\"northing (Y)\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1]],\n USAGE[\n SCOPE[\"unknown\"],\n AREA[\"France\"],\n BBOX[41.15,-9.86,51.56,10.38]],\n ID[\"EPSG\",2154]]"), class = "crs"), n_empty = 0L)), row.names = c(NA,
-5L), class = c("sf", "data.frame"), sf_column = "geometry", agr = structure(c(transect = NA_integer_), class = "factor", .Label = c("constant",
"aggregate", "identity")))
expect_equal(object = test,
expected = exp)
expect_is(test, "data.frame")
})
test_that("test erreur crop_transect", {
data(iris)
data("dataset_transects")
data("dataset_map")
expect_error(crop_transect(transect_obj = iris,
map_obj = dataset_map))
expect_error(crop_transect(transect_obj = dataset_transects,
map_obj = iris))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.