nnl: Complete and unique function to extrapolate a...

Description Usage Arguments Value Examples

View source: R/nnl.R

Description

Complete and unique function to extrapolate a SpatialLinesDataFrame A to a SpatialLinesDataFrame B

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
nnl(
  l_A,
  l_B,
  id_l_A,
  id_l_B,
  id_p_A = "ID_PTS_A",
  id_p_B = "ID_PTS_B",
  bfr_width = 100,
  step = 5,
  rate = 45,
  cut = F,
  p = T,
  ncores = NULL,
  verbose = F
)

Arguments

l_A

a SpatialLinesDataFrame. Reference lines.

l_B

a SpatialLinesDataFrame. Searched lines.

id_l_A

a character string. IDs Column name of reference SpatialLinesDataFrame (Lines A)

id_l_B

a character string. IDs Column name of searched SpatialLinesDataFrame (Lines B)

id_p_A

a character string. Indicates the IDs column name of points created to lines A. Default : "ID_PTS_A"

id_p_B

a character string. Indicates the IDs column name of points created to lines B. Default : "ID_PTS_B"

bfr_width

an integer. Buffer distance.

step

an integer. Define the distance between two points along the line in meters. Defautl = 5.

rate

an integer. Between 0 and 100. Define lower limit to select line B. Rate between number of points B on Lines A and totalpoints on Line B.

cut

logical. Define if function cut SpatialLinesDataFrame B to a smaller entities.

p

logical. Define if function use multithreading. Default = TRUE.

ncores

an integer. Number of CPU cores used. If NULL, all cores - 1 are used.

verbose

logical. View info for each step.

Value

a SpatialLinesDataFrame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
url_bresle <- paste0("https://api.sandre.eaufrance.fr/",
                     "coursdeau/v1/amont/G01-0400?pk_vid=aade75889c86a2471576396546bb9c85")
river_bresle <- rgdal::readOGR(url_bresle)

url_example <- "https://raw.githubusercontent.com/naub1n/nnl/master/example/example.geojson"
example <- rgdal::readOGR(url_example)

river_bresle <- sp::spTransform(river_bresle, sp::CRS("+init=epsg:2154"))

extrapolate_example <- nnl(l_A = example,
                           l_B = river_bresle,
                           id_l_A = "ID_EXAMPLE",
                           id_l_B = "CdEntiteHydrographique",
                           cut = T)

plot(river_bresle, col = "blue")
plot(example, col = "green", add = T)
plot(extrapolate_example, col = "red", add = T )

## End(Not run)

naub1n/nnl documentation built on Nov. 19, 2020, 3:44 a.m.