Description Usage Arguments Details Examples
simplifies a polyline using a vector-clustering algorithm
1 2 | SimplifyPolyline(polyline, distanceTolerance = 100, type = c("simple",
"complex"))
|
polyline |
encoded string of a polyline |
distanceTolerance |
in metres. For |
type |
the type of algorithm used to simplify the polyline. One of 'simple' or 'complex'. See Details |
This method computes the haversine distance between sequential sets of coordiantes,
and if they fall within the distancetolerance
value the coordinates are discarded
The 'simple' type
uses simple vector clustering to simplify the polyline,
which tests sequential coordinates to see if they fall within the distanceTolerance
.
The 'complex' type
uses the recursive Douglas Peucker algorithm to simplify the polyline.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
library(googleway)
dt_melbourne <- copy(googleway::melbourne)
setDT(dt_melbourne)
dt_melbourne[, dpSimple := SimplifyPolyline(polyline, 100, type = "complex")]
dt_melbourne[, Simple := SimplifyPolyline(polyline, 15000, type = "simple")]
object.size(dt_melbourne$polyline)
object.size(dt_melbourne$dpSimple)
object.size(dt_melbourne$Simple)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.