PolylineSimplifier

public class PolylineSimplifier
extension PolylineSimplifier: NativeBase
extension PolylineSimplifier: Hashable

PolylineSimplifier helps to reduce the number of points in the polyline by removing redundant elements using Douglas–Peucker algorithm, so that result stays within PolylineSimplifier.Options.

Typical use case is to perform input preparation step before invoking computationally heavy API. Such API have an upper limit on the input collection size and is subject to reduced performance when collection is huge. Examples of such API are:

  • Creates a new instance of PolylineSimplifier.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init() throws
  • Controls the strategy of PolylineSimplifier.simplify(...) when reducing a size of polyline.

    See more

    Declaration

    Swift

    public struct Options
  • Reduces the number of points in the input polyline. Does this by removing points which are not significant according to the passed PolylineSimplifier.Options. Simplification process is performed on the device without connecting to the network and is computationally intensive.

    Declaration

    Swift

    public func simplify(polyline: [GeoCoordinates], simplificationParameters: PolylineSimplifier.Options, completion: @escaping PolylineSimplificationCompletionHandler) -> TaskHandle

    Parameters

    polyline

    Input polyline that should be reduced in size.

    simplificationParameters

    Strategy, that controls the behavior of the underlying algorithm.

    completion

    Callback, which will be invoked on the main thread, when operation is finished.

    Return Value

    Controls an asynchronous operation.