EVOLUTION-MANAGER
Edit File: st_line_sample.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Sample points on a linear geometry</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for st_line_sample {sf}"><tr><td>st_line_sample {sf}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Sample points on a linear geometry</h2> <h3>Description</h3> <p>Sample points on a linear geometry </p> <h3>Usage</h3> <pre> st_line_sample(x, n, density, type = "regular", sample = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class <code>sf</code>, <code>sfc</code> or <code>sfg</code></p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>integer; number of points to choose per geometry; if missing, n will be computed as <code>round(density * st_length(geom))</code>.</p> </td></tr> <tr valign="top"><td><code>density</code></td> <td> <p>numeric; density (points per distance unit) of the sampling, possibly a vector of length equal to the number of features (otherwise recycled); <code>density</code> may be of class <code>units</code>.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>character; indicate the sampling type, either "regular" or "random"</p> </td></tr> <tr valign="top"><td><code>sample</code></td> <td> <p>numeric; a vector of numbers between 0 and 1 indicating the points to sample - if defined sample overrules n, density and type.</p> </td></tr> </table> <h3>Examples</h3> <pre> ls = st_sfc(st_linestring(rbind(c(0,0),c(0,1))), st_linestring(rbind(c(0,0),c(10,0)))) st_line_sample(ls, density = 1) ls = st_sfc(st_linestring(rbind(c(0,0),c(0,1))), st_linestring(rbind(c(0,0),c(.1,0))), crs = 4326) try(st_line_sample(ls, density = 1/1000)) # error st_line_sample(st_transform(ls, 3857), n = 5) # five points for each line st_line_sample(st_transform(ls, 3857), n = c(1, 3)) # one and three points st_line_sample(st_transform(ls, 3857), density = 1/1000) # one per km st_line_sample(st_transform(ls, 3857), density = c(1/1000, 1/10000)) # one per km, one per 10 km st_line_sample(st_transform(ls, 3857), density = units::set_units(1, 1/km)) # one per km # five equidistant points including start and end: st_line_sample(st_transform(ls, 3857), sample = c(0, 0.25, 0.5, 0.75, 1)) </pre> <hr /><div style="text-align: center;">[Package <em>sf</em> version 0.9-5 <a href="00Index.html">Index</a>]</div> </body></html>