SimplifyPolyline: Simplify Polyline

Description Usage Arguments Details Examples

Description

simplifies a polyline using a vector-clustering algorithm

Usage

1
2
SimplifyPolyline(polyline, distanceTolerance = 100, type = c("simple",
  "complex"))

Arguments

polyline

encoded string of a polyline

distanceTolerance

in metres. For simple, sequential points within this distance are dropped. For complex, it is the distance away from each line segment that determins if a point is kept (outside the distance is kept)

type

the type of algorithm used to simplify the polyline. One of 'simple' or 'complex'. See Details

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.

Examples

 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)

SymbolixAU/spatialdatatable documentation built on May 6, 2019, 11:20 a.m.