Fix boundingBox.center when spanning antimeridian (#13)
This package provides various geospatial extensions for GeoJSONKit. It is a fork of turf-swift, which is ported from Turf.js.
GeoJSONKitTurf requires Xcode 12.x and supports the following minimum deployment targets:
It’s also compatible with Linux (and possibly other platforms), as long as you have Swift 5.3 (or above) installed.
To install GeoJSONKitTurf using the Swift Package Manager, add the following package to the dependencies in your Package.swift file:
dependencies
.package(name: "GeoJSONKitTurf", url: "https://github.com/maparoni/geojsonkit-turf", from: "0.1.0")
Then use:
import GeoJSONKitTurf
This is a partial port of Turf.js, which adds the following functionality to GeoJSONKit‘s GeoJSON:
GeoJSON
GeoJSON.LineString.coordinateFromStart(distance:)
GeoJSON.Polygon.area
GeoJSON.Position.direction(to:)
RadianCoordinate2D.direction(to:)
GeoJSON.LineString.bezier(resolution:sharpness:)
GeoJSON.Polygon.contains(_:ignoreBoundary:)
GeoJSON.Geometry.center()
GeoJSON.Geometry.centerOfMass()
GeoJSON.Geometry.centroid()
GeoJSON.Polygon(center:radius:vertices:)
GeoJSON.convexHull()
Collection<GeoJSON.Position>.convexHull()
GeoJSON.Position.coordinate(at:facing:)
RadianCoordinate2D.coordinate(at:facing:)
GeoJSON.Position.distance(to:)
RadianCoordinate2D.distance(to:)
GeoJSON.Degrees.toRadians()
GeoJSON.DegreesRadians.toDegrees()
Measurement.converted(to:)
GeoJSON.LineString.distance(from:to:)
GeoJSON.LineString.intersection(with:)
GeoJSON.LineString.sliced(from:to:)
GeoJSON.LineString.trimmed(from:distance:)
GeoJSON.LineString.trimmed(from:to:)
mid(_:_:)
GeoJSON.LineString.closestCoordinate(to:)
GeoJSON.Geometry.nearestPoint(to:)
GeoJSON.Polygon.nearestPoint(to:)
GeoJSON.Polygon.smooth(iterations:)
GeoJSON.simplify(options:)
GeoJSON.Direction.difference(from:)
GeoJSON.Direction.wrap(min:max:)
Comes with a mini-CLI geokitten with these commands:
geokitten
geokitten simplify $input
First clone or download the repository, then run this:
swift build -c release sudo cp .build/release/geokitten /usr/local/bin/geokitten
mint install maparoni/GeoJSONKit-Turf@main
If you get a permissions error, check this Mint issue.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
GeoJSONKit+Turf
This package provides various geospatial extensions for GeoJSONKit. It is a fork of turf-swift, which is ported from Turf.js.
Requirements
GeoJSONKitTurf requires Xcode 12.x and supports the following minimum deployment targets:
It’s also compatible with Linux (and possibly other platforms), as long as you have Swift 5.3 (or above) installed.
Installation
Swift Package Manager
To install GeoJSONKitTurf using the Swift Package Manager, add the following package to the
dependencies
in your Package.swift file:Then use:
Available functionality
This is a partial port of Turf.js, which adds the following functionality to GeoJSONKit‘s
GeoJSON
:GeoJSON.LineString.coordinateFromStart(distance:)
GeoJSON.Polygon.area
GeoJSON.Position.direction(to:)
RadianCoordinate2D.direction(to:)
GeoJSON.LineString.bezier(resolution:sharpness:)
GeoJSON.Polygon.contains(_:ignoreBoundary:)
GeoJSON.Geometry.center()
GeoJSON.Geometry.centerOfMass()
GeoJSON.Geometry.centroid()
GeoJSON.Polygon(center:radius:vertices:)
GeoJSON.convexHull()
Collection<GeoJSON.Position>.convexHull()
GeoJSON.Position.coordinate(at:facing:)
RadianCoordinate2D.coordinate(at:facing:)
GeoJSON.Position.distance(to:)
RadianCoordinate2D.distance(to:)
GeoJSON.Degrees.toRadians()
GeoJSON.DegreesRadians.toDegrees()
turf-helpers#convertArea
Measurement.converted(to:)
GeoJSON.LineString.distance(from:to:)
GeoJSON.LineString.intersection(with:)
GeoJSON.LineString.sliced(from:to:)
GeoJSON.LineString.trimmed(from:distance:)
GeoJSON.LineString.trimmed(from:to:)
mid(_:_:)
GeoJSON.LineString.closestCoordinate(to:)
GeoJSON.Geometry.nearestPoint(to:)
GeoJSON.Polygon.nearestPoint(to:)
GeoJSON.Polygon.smooth(iterations:)
GeoJSON.simplify(options:)
GeoJSON.Direction.difference(from:)
GeoJSON.Direction.wrap(min:max:)
CLI
Comes with a mini-CLI
geokitten
with these commands:geokitten simplify $input
to simplify a GeoJSONInstallation
Via SPM
First clone or download the repository, then run this:
Via Mint
If you get a permissions error, check this Mint issue.