Description Usage Arguments Details Value See Also Examples
Douglas-Peucker is a recursive line simplification algorithm. It starts by defining a line from the first to the last point, and then finds the point that is furthest from the line. It then recursively breaks up the into two pieces around the furthest point, and finds the furthest point from those sublines. See http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm for more details.
1 | compute_dp_distance(data, x_var, y_var)
|
data |
A data frame like object. |
x_var,y_var |
Formulas specifying either variable names or expressions to use as x and y positions. |
Note that this function does not do any simplification - it just adds an additional column the measures the distaince between each point and it subline. Filtering on this column will perform simplification.
A data frame with columns:
x_,y_ |
Position |
distance_ |
Distance between point and sub-line |
geometry_simplify()
for an function that works on
a geometry and does simplification given tolerance or percentage of
points to keep.
1 2 3 4 5 6 | x <- 1:10
y <- x * 2
df <- data.frame(x, y)
# For a straight line, can remove all points except first and last
compute_dp_distance(df, ~x, ~y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.