Learn R Programming

spNetwork (version 0.2.1)

lixelize_lines.mc: Cut lines into lixels (multicore)

Description

Cut a SpatialLines object into lixels with a specified minimal distance may fail if the line geometries are self intersecting with multicore support.

Usage

lixelize_lines.mc(
  lines,
  lx_length,
  mindist = NULL,
  verbose = TRUE,
  chunk_size = 100
)

Arguments

lines

The SpatialLinesDataframe to modify

lx_length

The length of a lixel

mindist

The minimum length of a lixel. After cut, if the length of the final lixel is shorter than the minimum distance, then it is added to the previous lixel. If NULL, then mindist = maxdist/10

verbose

A Boolean indicating if a progress bar must be displayed

chunk_size

The size of a chunk used for multiprocessing. Default is 100.

Value

An object of class SpatialLinesDataFrame (package sp)

Examples

Run this code
# NOT RUN {
networkgpkg <- system.file("extdata", "networks.gpkg", package = "spNetwork", mustWork = TRUE)
mtl_network <- rgdal::readOGR(networkgpkg,layer="mtl_network", verbose=FALSE)
future::plan(future::multisession(workers=2))
lixels <- lixelize_lines.mc(mtl_network,150,50)
## make sure any open connections are closed afterward
if (!inherits(future::plan(), "sequential")){
future::plan(future::sequential)
}
# }

Run the code above in your browser using DataLab