# Generated by fusen: do not edit by hand
library(dplyr)
test_that("segmentize_transect works", {
expect_true(inherits(segmentize_transect, "function"))
})
test_that("test conformite segmentize_transect", {
data("dataset_transects")
test <- dataset_transects %>%
segmentize_transect(length_m = 2000,
to = "LINESTRING") %>%
slice(1:5)
exp <- structure(list(transect = c(1L, 2L, 2L, 2L, 2L), Effort = structure(c(293.602935093247,
1585.75628267987, 1585.75628267936, 1585.75628267987, 1585.75628267987
), units = structure(list(numerator = "m", denominator = character(0)), class = "symbolic_units"), class = "units"),
Sample.Label = c("1-1", "2-1", "2-2", "2-3", "2-4"), geometry = structure(list(
structure(c(-139470.020571824, -139732.795006128, 6280016.67344576,
6280147.64015974), .Dim = c(2L, 2L), class = c("XY",
"LINESTRING", "sfg")), structure(c(-144864.053202055,
-143541.841019279, 6280338.18167939, 6279462.75153839
), .Dim = c(2L, 2L), class = c("XY", "LINESTRING", "sfg"
)), structure(c(-143541.841019279, -142219.628836503,
6279462.75153839, 6278587.32139738), .Dim = c(2L, 2L), class = c("XY",
"LINESTRING", "sfg")), structure(c(-142219.628836503,
-140897.416653726, 6278587.32139738, 6277711.89125638
), .Dim = c(2L, 2L), class = c("XY", "LINESTRING", "sfg"
)), structure(c(-140897.416653726, -139575.20447095,
6277711.89125638, 6276836.46111538), .Dim = c(2L, 2L), class = c("XY",
"LINESTRING", "sfg"))), class = c("sfc_LINESTRING", "sfc"
), precision = 0, bbox = structure(c(xmin = -144864.053202055,
ymin = 6276836.46111538, xmax = -139470.020571824, ymax = 6280338.18167939
), 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("1",
"2", "2.1", "2.2", "2.3"), class = c("sf", "data.frame"), sf_column = "geometry", agr = structure(c(transect = NA_integer_,
Effort = NA_integer_, Sample.Label = NA_integer_), class = "factor", .Label = c("constant",
"aggregate", "identity")))
expect_equal(object = test,
expected = exp)
expect_is(test, "data.frame")
})
test_that("test erreur segmentize_transect", {
data(iris)
data("dataset_transect")
expect_error(object = segmentize_transect(transect_obj = iris,
length_m = 2000,
to = "LINESTRING"))
expect_error(object = segmentize_transect(transect_obj = dataset_transects,
length_m = iris,
to = "LINESTRING"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.