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
Copy file name to clipboardExpand all lines: Sources/GeoJSONKit/GeoJSON.swift
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -328,6 +328,11 @@ public struct GeoJSON: Hashable {
328
328
publicletmaximumElevation:Distance?
329
329
privateletminWasFirst:Bool
330
330
331
+
/// Creates a bounding box encapsulating the provided positions
332
+
///
333
+
/// - warning: This does not deal with spanning the antimeridian. So, the Fiji case from the GeoJSON specs would result in a 355 degree bounding box and not a 5 degree one. To deal with this, apply the appropriate logic on a level above and then use the `init(coordinates:)` constructor.
334
+
///
335
+
/// - Parameter positions: Positions to create the bounding box from; has to be at least one!
331
336
publicinit(positions:[Position]){
332
337
guardlet first = positions.first else{preconditionFailure()}
333
338
varminLat= first.latitude
@@ -349,6 +354,9 @@ public struct GeoJSON: Hashable {
349
354
minWasFirst =false
350
355
}
351
356
357
+
358
+
/// Create a bounding box from the provided coordinates
359
+
/// - Parameter coordinates: 4 or 6 elements in order: south-westerly longitude, south-westerly latitude, (elevation 1), north-easterly lontigude, north-easterly latitude, (elevation 2); where the elevations are optional (but either provide both or none) and there's no required order in which is the minimum and which is the maximum elevation.
352
360
publicinit(coordinates:[Degrees])throws{
353
361
switch coordinates.count {
354
362
case6:
@@ -398,25 +406,25 @@ public struct GeoJSON: Hashable {
0 commit comments