Skip to content

Repository files navigation

ASPolygonKit

CI

Functionality:

  • Polygon union

ASPolygonKit is tested and confirmed working on on iOS, macOS and Linux. It might work on other platforms, too.

Installation

Swift Package Manager

To install ASPolygonKit using the Swift Package Manager, add the following package to the dependencies in your Package.swift file:

.package(name:"ASPolygonKit", url:"https://github.com/nighthawk/aspolygonkit.git", from:"0.4.0"),

Usage

import ASPolygonKit in any Swift file in your module.

Example, usage merging a GeoJSON polygon from GeoJSONKit:

import GeoJSONKit
import ASPolygonKit
extensionGeoJSON.Polygon{publicstaticfunc union(_ polygons:[GeoJSON.Polygon])throws->[GeoJSON.Polygon]{tryASPolygonKit.Polygon.union(polygons.map(ASPolygonKit.Polygon.init)).map{ polygon in.init(exterior:.init(positions: polygon.points.map{.init(latitude: $0.lat, longitude: $0.lng)}))}}}privateextensionASPolygonKit.Polygon{init(_ geojson:GeoJSON.Polygon){self.init(points: geojson.exterior.positions.map{.init(latitude: $0.latitude, longitude: $0.longitude)})}}

Author

adrian@schoenig.me

License

ASPolygonKit is available under the MIT license. See the LICENSE file for more info.

About

A little Swift toolkit for working with polygons

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages