Skip to content

Commit 5c90194

Browse files
committed
📖 Add documentation to GeoJSON
1 parent 16108d2 commit 5c90194

20 files changed

+156
-14
lines changed

‎Sources/GeoJSON/BoundingBox.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88

99
import GeoModels
1010

11+
/// A [GeoJSON Bounding Box](https://datatracker.ietf.org/doc/html/rfc7946#section-5).
1112
public protocol BoundingBox: Hashable, Codable {
1213

14+
/// This bonding box, but type-erased.
1315
var asAny: AnyBoundingBox { get }
1416

1517
}
1618

19+
/// A two-dimensional ``BoundingBox``.
1720
public typealias BoundingBox2D = GeoModels.BoundingBox2D
1821

1922
extension BoundingBox2D: BoundingBox {
@@ -22,6 +25,7 @@ extension BoundingBox2D: BoundingBox {
2225

2326
}
2427

28+
/// A three-dimensional ``BoundingBox``.
2529
public typealias BoundingBox3D = GeoModels.BoundingBox3D
2630

2731
extension BoundingBox3D: BoundingBox {
@@ -30,6 +34,7 @@ extension BoundingBox3D: BoundingBox {
3034

3135
}
3236

37+
/// A type-erased ``BoundingBox``.
3338
public enum AnyBoundingBox: BoundingBox, Hashable, Codable {
3439

3540
case twoDimensions(BoundingBox2D)

‎Sources/GeoJSON/Errors.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import Foundation
1010

11+
/// Error when creating ``LinearRingCoordinates``.
12+
///
1113
/// See [RFC 7946, section 3.1.6](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6).
1214
public enum LinearRingError: Error {
1315
case firstAndLastPositionsShouldBeEquivalent
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// FeatureProperties.swift
3+
// GeoSwift
4+
//
5+
// Created by Rémi Bardon on 04/02/2022.
6+
// Copyright © 2022 Rémi Bardon. All rights reserved.
7+
//
8+
9+
/// The `"properties"` field of a [GeoJSON Feature](https://datatracker.ietf.org/doc/html/rfc7946#section-3.2).
10+
public typealias FeatureProperties = Codable & Hashable
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ``GeoJSON``
2+
3+
## Topics
4+
5+
### Positions
6+
7+
- ``Position``
8+
- ``Position2D``
9+
- ``Position3D``
10+
11+
### Types
12+
13+
- <doc:Types>
14+
15+
### Objects
16+
17+
- ``Object``
18+
- <doc:Geometries>
19+
- ``Feature``
20+
- ``FeatureCollection``
21+
22+
### Bounding Boxes
23+
24+
- ``BoundingBox``
25+
- ``BoundingBox2D``
26+
- ``BoundingBox3D``
27+
- ``AnyBoundingBox``
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Geometries
2+
3+
## Topics
4+
5+
### Base
6+
7+
- ``Geometry``
8+
- ``AnyGeometry``
9+
10+
### Introduced concepts
11+
12+
- ``SingleGeometry``
13+
- ``LinearRingCoordinates``
14+
- ``LinearRingError``
15+
16+
### Point
17+
18+
- ``Point``
19+
- ``Point2D``
20+
- ``Point3D``
21+
22+
### MultiPoint
23+
24+
- ``MultiPoint``
25+
- ``MultiPoint2D``
26+
- ``MultiPoint3D``
27+
28+
### LineString
29+
30+
- ``LineString``
31+
- ``LineString2D``
32+
- ``LineString3D``
33+
34+
### MultiLineString
35+
36+
- ``MultiLineString``
37+
- ``MultiLineString2D``
38+
- ``MultiLineString3D``
39+
40+
### Polygon
41+
42+
- ``Polygon``
43+
- ``Polygon2D``
44+
- ``Polygon3D``
45+
46+
### MultiPolygon
47+
48+
- ``MultiPolygon``
49+
- ``MultiPolygon2D``
50+
- ``MultiPolygon3D``
51+
52+
### GeometryCollection
53+
54+
- ``GeometryCollection``
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Types
2+
3+
## Topics
4+
5+
### Enums
6+
7+
- ``Type``
8+
- ``Type/Geometry``
9+
10+
### Cases
11+
12+
- ``Type/Geometry/point``
13+
- ``Type/Geometry/multiPoint``
14+
- ``Type/Geometry/lineString``
15+
- ``Type/Geometry/multiLineString``
16+
- ``Type/Geometry/polygon``
17+
- ``Type/Geometry/multiPolygon``
18+
- ``Type/Geometry/geometryCollection``
19+
- ``Type/feature``
20+
- ``Type/featureCollection``

‎Sources/GeoJSON/Geometries/GeometryCollection.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
// Copyright © 2022 Rémi Bardon. All rights reserved.
77
//
88

9+
/// A [GeoJSON GeometryCollection](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.8).
910
public struct GeometryCollection: Geometry {
1011

11-
public static var geometryType: GeoJSON.`Type`.Geometry { .geometryCollection}
12+
public static var geometryType: GeoJSON.`Type`.Geometry { .geometryCollection }
1213

1314
public var bbox: AnyBoundingBox?
1415

‎Sources/GeoJSON/Geometries/LineString.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
import NonEmpty
1010

11+
/// A [GeoJSON LineString](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.4).
1112
public protocol LineString: SingleGeometry {
1213

1314
associatedtype Position: GeoJSON.Position
1415
associatedtype Coordinates = NonEmpty<NonEmpty<[Position]>>
1516

1617
}
1718

19+
/// A ``LineString`` with ``Point2D``s.
1820
public struct LineString2D: LineString {
1921

2022
public typealias Position = Position2D
@@ -39,6 +41,7 @@ public struct LineString2D: LineString {
3941

4042
}
4143

44+
/// A ``LineString`` with ``Point3D``s.
4245
public struct LineString3D: LineString {
4346

4447
public typealias Position = Position3D

‎Sources/GeoJSON/Geometries/MultiLineString.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
import NonEmpty
1010

11+
/// A [GeoJSON MultiLineString](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.5).
1112
public protocol MultiLineString: SingleGeometry {
1213

1314
associatedtype LineString: GeoJSON.LineString
1415
associatedtype Coordinates = [LineString.Coordinates]
1516

1617
}
1718

19+
/// A ``MultiLineString`` with ``Point2D``s.
1820
public struct MultiLineString2D: MultiLineString {
1921

2022
public typealias LineString = LineString2D
@@ -45,6 +47,7 @@ public struct MultiLineString2D: MultiLineString {
4547

4648
}
4749

50+
/// A ``MultiLineString`` with ``Point3D``s.
4851
public struct MultiLineString3D: MultiLineString {
4952

5053
public typealias LineString = LineString3D

‎Sources/GeoJSON/Geometries/MultiPoint.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
// Copyright © 2022 Rémi Bardon. All rights reserved.
77
//
88

9+
/// A [GeoJSON MultiPoint](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.3).
910
public protocol MultiPoint: SingleGeometry {
1011

1112
associatedtype Point: GeoJSON.Point
1213
associatedtype Coordinates = [Point.Coordinates]
1314

1415
}
1516

17+
/// A ``MultiPoint`` with ``Point2D``s.
1618
public struct MultiPoint2D: MultiPoint {
1719

1820
public typealias Point = Point2D
@@ -29,6 +31,7 @@ public struct MultiPoint2D: MultiPoint {
2931

3032
}
3133

34+
/// A ``MultiPoint`` with ``Point3D``s.
3235
public struct MultiPoint3D: MultiPoint {
3336

3437
public typealias Point = Point3D

0 commit comments

Comments
 (0)