Skip to content

Commit 0139bcc

Browse files
committed
refactor: define Position type for GeoJSON objects
1 parent 79960e1 commit 0139bcc

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/driver/types/GeoJsonTypes.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,66 @@
1+
/**
2+
* Position object.
3+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1
4+
*/
5+
export type Position = number[]
6+
17
/**
28
* Point geometry object.
3-
* https://tools.ietf.org/html/rfc7946#section-3.1.2
9+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.2
410
*/
511
export type Point = {
612
type: "Point"
7-
coordinates: number[]
13+
coordinates: Position
814
}
915

1016
/**
1117
* LineString geometry object.
12-
* https://tools.ietf.org/html/rfc7946#section-3.1.4
18+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.4
1319
*/
1420
export type LineString = {
1521
type: "LineString"
16-
coordinates: number[][]
22+
coordinates: Position[]
1723
}
1824

1925
/**
2026
* Polygon geometry object.
21-
* https://tools.ietf.org/html/rfc7946#section-3.1.6
27+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6
2228
*/
2329
export type Polygon = {
2430
type: "Polygon"
25-
coordinates: number[][][]
31+
coordinates: Position[][]
2632
}
2733

2834
/**
2935
* MultiPoint geometry object.
30-
* https://tools.ietf.org/html/rfc7946#section-3.1.3
36+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.3
3137
*/
3238
export type MultiPoint = {
3339
type: "MultiPoint"
34-
coordinates: number[][]
40+
coordinates: Position[]
3541
}
3642

3743
/**
3844
* MultiLineString geometry object.
39-
* https://tools.ietf.org/html/rfc7946#section-3.1.5
45+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.5
4046
*/
4147
export type MultiLineString = {
4248
type: "MultiLineString"
43-
coordinates: number[][][]
49+
coordinates: Position[][]
4450
}
4551

4652
/**
4753
* MultiPolygon geometry object.
48-
* https://tools.ietf.org/html/rfc7946#section-3.1.7
54+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.7
4955
*/
5056
export type MultiPolygon = {
5157
type: "MultiPolygon"
52-
coordinates: number[][][][]
58+
coordinates: Position[][][]
5359
}
5460

5561
/**
5662
* Geometry Collection
57-
* https://tools.ietf.org/html/rfc7946#section-3.1.8
63+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.8
5864
*/
5965
export type GeometryCollection = {
6066
type: "GeometryCollection"
@@ -83,7 +89,7 @@ export type Geography = Geometry
8389

8490
/**
8591
* A feature object which contains a geometry and associated properties.
86-
* https://tools.ietf.org/html/rfc7946#section-3.2
92+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.2
8793
*/
8894
export type Feature = {
8995
type: "Feature"
@@ -95,7 +101,7 @@ export type Feature = {
95101

96102
/**
97103
* A collection of feature objects.
98-
* https://tools.ietf.org/html/rfc7946#section-3.3
104+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.3
99105
*/
100106
export type FeatureCollection = {
101107
type: "FeatureCollection"

0 commit comments

Comments
 (0)