line_sample {stplanr}R Documentation

Sample n points along lines with density proportional to a weight

Description

Sample n points along lines with density proportional to a weight

Usage

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

Other lines: angle_diff(), geo_toptail(), is_linepoint(), line2df(), line2points(), line_bearing(), line_breakup(), line_midpoint(), line_segment(), line_via(), mats2line(), n_sample_length(), n_vertices(), onewaygeo(), points2line(), toptail_buff(), toptailgs(), update_line_geometry()

Examples

l <- flowlines[2:5, ]
n <- 100
l_lengths <- line_length(l)
weights <- l$All
p <- line_sample(l, 50, weights)
plot(p)
p <- line_sample(l, 50, weights = 1:length(l))
plot(p)

[Package stplanr version 0.8.7 Index]