You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Adds equivalents of turf-line-chunk
Also:
- GeoJSON.LineString.length
- GeoJSON.Polygon.LinearRing.circumference
* Potential help for Linux
* Come on, Linux...
* Add tests
* README review
* Improvements:
- New `GeoJSON.GeometryObject(splittingWhenCrossingAntiMeridian:)` helper
- Rename `clip(to:)` to `clipped(to:)`
- Adds `GeoJSON.LineString.clipped(to:)`
- Move algorithms to algorithms folder
This package provides various geospatial extensions for [GeoJSONKit](https://github.com/maparoni/geojsonkit). It is a fork of [turf-swift](https://github.com/mapbox/turf-swift.git), which is ported from[Turf.js](https://github.com/Turfjs/turf/).
7
+
This package provides various geospatial extensions for [GeoJSONKit](https://github.com/maparoni/geojsonkit). It is a fork of [turf-swift](https://github.com/mapbox/turf-swift.git), which itself is a partial Swift-port of[Turf.js](https://github.com/Turfjs/turf/).
8
8
9
9
## Requirements
10
10
@@ -13,6 +13,7 @@ GeoJSONKitTurf requires Xcode 14.x and supports the following minimum deployment
13
13
- iOS 15 and above
14
14
- macOS 12 and above
15
15
- tvOS 15 and above
16
+
- visionOS 1.0 and above
16
17
- watchOS 8.0 and above
17
18
18
19
It's also compatible with Linux (and possibly other platforms), as long as you have [Swift](https://swift.org/download/) 5.7 (or above) installed.
@@ -24,7 +25,7 @@ It's also compatible with Linux (and possibly other platforms), as long as you h
24
25
To install GeoJSONKitTurf using the [Swift Package Manager](https://swift.org/package-manager/), add the following package to the `dependencies` in your Package.swift file:
[turf-union](https://github.com/Turfjs/turf/tree/master/packages/turf-union) | Not provided, but see [ASPolygonKit](https://github.com/nighthawk/ASPolygonKit)
Additionally, it adds the following features, which do not have a direct equivalent in turf.js:
73
+
74
+
*`GeoJSON.Direction.difference(from:)`
75
+
*`GeoJSON.Direction.wrap(min:max:)`
76
+
*`GeoJSON.LineString.frechetDistance(to:)`: Determines the [Fréchet distance](https://en.wikipedia.org/wiki/Fréchet_distance) between two line strings, which is a measure of their similarity.
77
+
*`GeoJSON.GeometryObject(splittingWhenCrossingAntiMeridian:)`: Breaks up a LineString or Polygon into two when crossing the anti-meridian.
return.init(positions:SutherlandHodgeman.clip(positions, to: boundingBox, close:false))
38
+
}
39
+
31
40
/**
32
41
Returns the portion of the line string that begins at the given start distance and extends the given stop distance along the line string.
33
42
34
43
This method is equivalent to the [turf-line-slice-along](https://turfjs.org/docs/#lineSliceAlong) package of Turf.js ([source code](https://github.com/Turfjs/turf/tree/master/packages/turf-line-slice-along/)).
35
44
*/
36
45
publicfunc trimmed(from startDistance:GeoJSON.Distance, to stopDistance:GeoJSON.Distance)->GeoJSON.LineString?{
37
-
// The method is porting from https://github.com/Turfjs/turf/blob/5375941072b90d489389db22b43bfe809d5e451e/packages/turf-line-slice-along/index.js
/// Divides a ``GeoJSON.LineString`` into chunks of a specified length.
207
+
/// If the line is shorter than the segment length then the original line is returned.
208
+
///
209
+
/// Adopted This function is roughly equivalent to the [turf-line-chunk](https://turfjs.org/docs/#lineChunk) package of Turf.js ([source code](https://github.com/Turfjs/turf/tree/master/packages/turf-line-chunk/)). However, it returns another line string
210
+
/// rather than a feature collection.
211
+
///
212
+
/// - Parameter length: How long to make each segment, in metres.
213
+
/// - Returns: Line string with positions repeating as requested.
0 commit comments