Sample n points along lines with density proportional to a weight

line_sample(l, n, weights)

Arguments

l

The SpatialLines object along which to create sample points

n

The total number of points to sample

weights

The relative probabilities of lines being samples

See also

Examples

l <- flowlines[2:5, ] n <- 100 l_lengths <- line_length(l)
#> Transforming to CRS +proj=aeqd +lat_0=53.82569002 +lon_0=-1.5274551 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
weights <- l$All p <- line_sample(l, 50, weights)
#> Warning: CRS object has comment, which is lost in output
#> Warning: CRS object has comment, which is lost in output
#> Warning: Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
plot(p)
p <- line_sample(l, 50, weights = 1:length(l))
#> Warning: CRS object has comment, which is lost in output
#> Warning: CRS object has comment, which is lost in output
#> Warning: Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
plot(p)