@springfield/ham-radio-api 18.0.1 → 18.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bryan Hunt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial
12
+ portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
16
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -6,6 +6,10 @@ Packages that talk to radios depend on this library. It does not open a serial p
6
6
 
7
7
  Docs: [HamBench developer docs](https://springfield-ham-radio.github.io/ham-radio-docs/developer/)
8
8
 
9
+ ## License
10
+
11
+ MIT — Copyright (c) 2026 Bryan Hunt. See [LICENSE](LICENSE).
12
+
9
13
  ```bash
10
14
  corepack enable
11
15
  yarn install
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./spectrum/channel.js";
38
38
  export * from "./spectrum/mode.js";
39
39
  export * from "./spectrum/privilege.js";
40
40
  export * from "./antenna/type.js";
41
+ export * from "./station/geo-point.js";
41
42
  export * from "./station/radio-station.js";
42
43
  export * from "./station/antenna.js";
43
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,C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c,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ export * from "./spectrum/channel.js";
38
38
  export * from "./spectrum/mode.js";
39
39
  export * from "./spectrum/privilege.js";
40
40
  export * from "./antenna/type.js";
41
+ export * from "./station/geo-point.js";
41
42
  export * from "./station/radio-station.js";
42
43
  export * from "./station/antenna.js";
43
44
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cA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AAChC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAElC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export declare const MIN_LATITUDE = -90;
13
+ export declare const MAX_LATITUDE = 90;
14
+ export declare const MIN_LONGITUDE = -180;
15
+ export declare const MAX_LONGITUDE = 180;
16
+ /**
17
+ * A point on the WGS84 ellipsoid as signed decimal degrees (south / west negative).
18
+ */
19
+ export interface GeoPoint {
20
+ latitude: number;
21
+ longitude: number;
22
+ }
23
+ /**
24
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
25
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
26
+ */
27
+ export declare function isGeoPoint(value: unknown): value is GeoPoint;
28
+ //# sourceMappingURL=geo-point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-point.d.ts","sourceRoot":"","sources":["../../src/station/geo-point.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAgB5D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export const MIN_LATITUDE = -90;
13
+ export const MAX_LATITUDE = 90;
14
+ export const MIN_LONGITUDE = -180;
15
+ export const MAX_LONGITUDE = 180;
16
+ /**
17
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
18
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
19
+ */
20
+ export function isGeoPoint(value) {
21
+ if (typeof value !== "object" || value === null) {
22
+ return false;
23
+ }
24
+ const candidate = value;
25
+ return (typeof candidate.latitude === "number" &&
26
+ typeof candidate.longitude === "number" &&
27
+ Number.isFinite(candidate.latitude) &&
28
+ Number.isFinite(candidate.longitude) &&
29
+ candidate.latitude >= MIN_LATITUDE &&
30
+ candidate.latitude <= MAX_LATITUDE &&
31
+ candidate.longitude >= MIN_LONGITUDE &&
32
+ candidate.longitude <= MAX_LONGITUDE);
33
+ }
34
+ //# sourceMappingURL=geo-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-point.js","sourceRoot":"","sources":["../../src/station/geo-point.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAUjC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,KAAiB,CAAC;IACpC,OAAO,CACL,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,OAAO,SAAS,CAAC,SAAS,KAAK,QAAQ;QACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC;QACpC,SAAS,CAAC,QAAQ,IAAI,YAAY;QAClC,SAAS,CAAC,QAAQ,IAAI,YAAY;QAClC,SAAS,CAAC,SAAS,IAAI,aAAa;QACpC,SAAS,CAAC,SAAS,IAAI,aAAa,CACrC,CAAC;AACJ,CAAC"}
@@ -1,11 +1,9 @@
1
+ import type { GeoPoint } from "./geo-point.js";
1
2
  /**
2
3
  * Default Home site id. HamBench always has at least this station.
3
4
  */
4
5
  export declare const HOME_STATION_ID = "station-home";
5
- export declare const MIN_LATITUDE = -90;
6
- export declare const MAX_LATITUDE = 90;
7
- export declare const MIN_LONGITUDE = -180;
8
- export declare const MAX_LONGITUDE = 180;
6
+ export { MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, } from "./geo-point.js";
9
7
  /**
10
8
  * Whether the operator last edited the Maidenhead grid or the coordinates.
11
9
  *
@@ -19,12 +17,10 @@ export type StationLocationSource = "grid" | "coordinates";
19
17
  * Latitude and longitude are signed decimal degrees (south / west negative).
20
18
  * UIs may collect them as degrees, minutes, and decimal seconds.
21
19
  */
22
- export interface RadioStation {
20
+ export interface RadioStation extends Partial<GeoPoint> {
23
21
  id: string;
24
22
  nickname: string;
25
23
  gridsquare?: string;
26
- latitude?: number;
27
- longitude?: number;
28
24
  locationSource?: StationLocationSource;
29
25
  createdAt: number;
30
26
  updatedAt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-station.d.ts","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"radio-station.d.ts","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,QAAQ,CAAC;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -2,8 +2,5 @@
2
2
  * Default Home site id. HamBench always has at least this station.
3
3
  */
4
4
  export const HOME_STATION_ID = "station-home";
5
- export const MIN_LATITUDE = -90;
6
- export const MAX_LATITUDE = 90;
7
- export const MIN_LONGITUDE = -180;
8
- export const MAX_LONGITUDE = 180;
5
+ export { MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, } from "./geo-point.js";
9
6
  //# sourceMappingURL=radio-station.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-station.js","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"radio-station.js","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@springfield/ham-radio-api",
3
- "version": "18.0.1",
3
+ "version": "18.1.0",
4
4
  "author": "Bryan Hunt",
5
+ "license": "MIT",
5
6
  "files": [
6
7
  "dist/",
7
8
  "src/"
@@ -35,15 +36,15 @@
35
36
  "@commitlint/config-conventional": "21.2.3",
36
37
  "@semantic-release/changelog": "7.0.0",
37
38
  "@semantic-release/git": "11.0.1",
38
- "@semantic-release/github": "12.0.9",
39
- "@semantic-release/npm": "13.1.5",
39
+ "@semantic-release/github": "12.0.10",
40
+ "@semantic-release/npm": "13.2.0",
40
41
  "husky": "9.1.7",
41
- "oxfmt": "^0.68.0",
42
- "oxlint": "1.83.0",
42
+ "oxfmt": "^0.71.0",
43
+ "oxlint": "1.86.0",
43
44
  "semantic-release": "25.0.9",
44
45
  "typescript": "7.0.2",
45
- "vite": "^8.3.0",
46
- "vitest": "^5.0.1"
46
+ "vite": "^8.3.2",
47
+ "vitest": "^5.0.3"
47
48
  },
48
49
  "resolutions": {
49
50
  "conventional-changelog-conventionalcommits": "9.3.1"
package/src/index.ts CHANGED
@@ -43,5 +43,6 @@ export * from "./spectrum/privilege.js";
43
43
 
44
44
  export * from "./antenna/type.js";
45
45
 
46
+ export * from "./station/geo-point.js";
46
47
  export * from "./station/radio-station.js";
47
48
  export * from "./station/antenna.js";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export const MIN_LATITUDE = -90;
13
+ export const MAX_LATITUDE = 90;
14
+ export const MIN_LONGITUDE = -180;
15
+ export const MAX_LONGITUDE = 180;
16
+
17
+ /**
18
+ * A point on the WGS84 ellipsoid as signed decimal degrees (south / west negative).
19
+ */
20
+ export interface GeoPoint {
21
+ latitude: number;
22
+ longitude: number;
23
+ }
24
+
25
+ /**
26
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
27
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
28
+ */
29
+ export function isGeoPoint(value: unknown): value is GeoPoint {
30
+ if (typeof value !== "object" || value === null) {
31
+ return false;
32
+ }
33
+
34
+ const candidate = value as GeoPoint;
35
+ return (
36
+ typeof candidate.latitude === "number" &&
37
+ typeof candidate.longitude === "number" &&
38
+ Number.isFinite(candidate.latitude) &&
39
+ Number.isFinite(candidate.longitude) &&
40
+ candidate.latitude >= MIN_LATITUDE &&
41
+ candidate.latitude <= MAX_LATITUDE &&
42
+ candidate.longitude >= MIN_LONGITUDE &&
43
+ candidate.longitude <= MAX_LONGITUDE
44
+ );
45
+ }
@@ -1,12 +1,16 @@
1
+ import type { GeoPoint } from "./geo-point.js";
2
+
1
3
  /**
2
4
  * Default Home site id. HamBench always has at least this station.
3
5
  */
4
6
  export const HOME_STATION_ID = "station-home";
5
7
 
6
- export const MIN_LATITUDE = -90;
7
- export const MAX_LATITUDE = 90;
8
- export const MIN_LONGITUDE = -180;
9
- export const MAX_LONGITUDE = 180;
8
+ export {
9
+ MAX_LATITUDE,
10
+ MAX_LONGITUDE,
11
+ MIN_LATITUDE,
12
+ MIN_LONGITUDE,
13
+ } from "./geo-point.js";
10
14
 
11
15
  /**
12
16
  * Whether the operator last edited the Maidenhead grid or the coordinates.
@@ -22,12 +26,10 @@ export type StationLocationSource = "grid" | "coordinates";
22
26
  * Latitude and longitude are signed decimal degrees (south / west negative).
23
27
  * UIs may collect them as degrees, minutes, and decimal seconds.
24
28
  */
25
- export interface RadioStation {
29
+ export interface RadioStation extends Partial<GeoPoint> {
26
30
  id: string;
27
31
  nickname: string;
28
32
  gridsquare?: string;
29
- latitude?: number;
30
- longitude?: number;
31
33
  locationSource?: StationLocationSource;
32
34
  createdAt: number;
33
35
  updatedAt: number;