Skip to content

Compression algorithm to a collection of CLLocationCoordinate2D

License

Notifications You must be signed in to change notification settings

wlltmrt/pointcompression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PointCompression

Build Status Swift 5 Version Software License Swift Package Manager Compatible

A compression algorithm to encodes/decodes a collection of CLLocationCoordinate2D into a string. check out the post: microsoft.com.

Requirements

Swift 5 and beyond.

Usage

import CoreLocation
import PointCompression

extension CLLocationCoordinate2D {
    static func random() -> CLLocationCoordinate2D {
        return CLLocationCoordinate2D(latitude: Double(arc4random_uniform(140)) * 0.00001,
                                      longitude: Double(arc4random_uniform(140)) * 0.00001)
    }
}

func main() {
    var coordinates = [CLLocationCoordinate2D]()

    for _ in 0...3000 {
        coordinates.append(.random())
    }

    let stringValue = PointCompression.Encode(coordinates)
    let decodedCoordinates = PointCompression.Decode(stringValue)
}

License

MIT

About

Compression algorithm to a collection of CLLocationCoordinate2D

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages