Latest 1.1.0
Homepage https://github.com/tomislav/Simplify-Swift
License MIT
Platforms ios 9.3
Authors

Version
License
Platform

Simplify-Swift is a high-performance Swift polyline simplification library ported from Simplify.js. The original Javascript library was extracted from Leaflet, a JS interactive maps library by Vladimir Agafonkin. It uses a combination of Douglas-Peucker and Radial Distance algorithms.

Polyline simplification dramatically reduces the number of points in a polyline while retaining its shape, giving a huge performance boost when processing it and also reducing visual noise. For example, it’s essential when rendering a large polyline in MapKit.

Simplify-Swift screenshot

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

Simplify-Swift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Simplify-Swift'

Usage

class func simplify<T:SimplifyValue>(_ points: [T], tolerance: Float?, highQuality: Bool = false) -> [T]

Returns an array of simplified points

  • parameter points: An array of points of SimplifyValue {x: Double, y: Double} format. Generics are supported so you can pass in an array of [CGPoint] or [CLLocationCoordinate2D].
  • parameter tolerance: Affects the amount of simplification (in the same metric as the point coordinates). Default: 1.
  • parameter highQuality: Excludes distance-based preprocessing step which leads to highest quality simplification but runs ~10-20 times slower. Default: false.

Author

Tomislav Filipcic, [email protected], @tomislav

License

Simplify-Swift is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Simplify-Swift",
    "version": "1.1.0",
    "summary": "A high performance Swift 2D/3D polyline simplification library",
    "description": "Simplify-Swift is a high-performance Swift polyline simplification library ported from Simplify.js. The original Javascript library was extracted from Leaflet, a JS interactive maps library by Vladimir Agafonkin. It uses a combination of Douglas-Peucker and Radial Distance algorithms. Polyline simplification dramatically reduces the number of points in a polyline while retaining its shape, giving a huge performance boost when processing it and also reducing visual noise.",
    "homepage": "https://github.com/tomislav/Simplify-Swift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tomislav Filipcic": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tomislav/Simplify-Swift.git",
        "tag": "1.1.0"
    },
    "social_media_url": "https://twitter.com/tomislav",
    "platforms": {
        "ios": "9.3"
    },
    "source_files": "Simplify-Swift/Classes/**/*",
    "swift_version": "5.0"
}

Pin It on Pinterest

Share This