Skip to content

Commit bb1d0fc

Browse files
committed
Update Build
1 parent d429664 commit bb1d0fc

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

lib/parser/normalize_geojson.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { v4 as randomUUID } from 'uuid';
33
import type { Static } from '@sinclair/typebox';
44
import { coordEach } from "@turf/meta";
55
import TypeValidator from '../type.js';
6+
import { Feature } from '../types/feature.js';
67
import PointOnFeature from '@turf/point-on-feature';
78
import { GeoJSONFeature } from '../types/geojson.js';
89

@@ -39,7 +40,7 @@ export async function normalize_geojson(
3940
} else if (feature.geometry.type === 'Polygon') {
4041
feature.properties.type = 'u-d-f';
4142
} else {
42-
throw new Err(400, null, `Unsupported Geometry Type: ${feature.geometry.type}`);
43+
throw new Err(400, null, `Unsupported Geometry Type`);
4344
}
4445

4546
for (const color of ['marker-color', 'stroke', 'fill']) {
@@ -74,7 +75,7 @@ export async function normalize_geojson(
7475

7576
// Remarks Options
7677
for (const remarks of ['remarks', 'description']) {
77-
if (props[remarks] && typeof props[remakrs] === 'string') {
78+
if (props[remarks] && typeof props[remarks] === 'string') {
7879
feature.properties.remarks = props[remarks];
7980
break;
8081
}

test/normalize_geojson.test.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,24 @@ test('normalize_geojson - Point', async (t) => {
2424
});
2525

2626
t.ok(feat.properties.start);
27-
delete feat.properties.start;
27+
feat.properties.start = '2025-07-14T03:00:57.112Z';
2828
t.ok(feat.properties.time);
29-
delete feat.properties.time;
29+
feat.properties.time = '2025-07-14T03:00:57.112Z';
3030
t.ok(feat.properties.stale);
31-
delete feat.properties.stale;
31+
feat.properties.stale = '2025-07-14T03:00:57.112Z';
3232

3333
t.deepEquals(feat, {
3434
id: '3dcbbdf0-b832-4f86-ac8b-d33f64acfad5',
3535
type: 'Feature',
3636
properties: {
3737
type: 'u-d-p',
38-
metadata: {},
3938
archived: false,
4039
callsign: 'New Feature',
4140
remarks: '',
4241
'marker-color': 'FF0000',
42+
time: '2025-07-14T03:00:57.112Z',
43+
start: '2025-07-14T03:00:57.112Z',
44+
stale: '2025-07-14T03:00:57.112Z',
4345
center: [
4446
-108.2982,
4547
39.0833
@@ -96,25 +98,27 @@ test('normalize_geojson - LineString', async (t) => {
9698
});
9799

98100
t.ok(feat.properties.start);
99-
delete feat.properties.start;
101+
feat.properties.start = '2025-07-14T03:00:57.112Z';
100102
t.ok(feat.properties.time);
101-
delete feat.properties.time;
103+
feat.properties.time = '2025-07-14T03:00:57.112Z';
102104
t.ok(feat.properties.stale);
103-
delete feat.properties.stale;
105+
feat.properties.stale = '2025-07-14T03:00:57.112Z';
104106

105107
t.deepEquals(feat, {
106108
id:"d9e51148-ca9d-4a82-a032-afe9fbc9d2e1",
107109
type:"Feature",
108110
properties:{
109111
type: 'u-d-f',
110-
metadata: {},
111112
archived: false,
112113
stroke: "#FFAA00",
113114
fill: "#FFAA00",
114115
'stroke-opacity': 1,
115116
'stroke-width': 2,
116117
callsign: 'Proposed route',
117118
remarks: '',
119+
time: '2025-07-14T03:00:57.112Z',
120+
start: '2025-07-14T03:00:57.112Z',
121+
stale: '2025-07-14T03:00:57.112Z',
118122
center: [ -108.29433, 39.11486 ],
119123
metadata: {
120124
"-updated-by":"16SV07",
@@ -164,18 +168,17 @@ test('normalize_geojson - Polygon', async (t) => {
164168
});
165169

166170
t.ok(feat.properties.start);
167-
delete feat.properties.start;
171+
feat.properties.start = '2025-07-14T03:00:57.112Z';
168172
t.ok(feat.properties.time);
169-
delete feat.properties.time;
173+
feat.properties.time = '2025-07-14T03:00:57.112Z';
170174
t.ok(feat.properties.stale);
171-
delete feat.properties.stale;
175+
feat.properties.stale = '2025-07-14T03:00:57.112Z';
172176

173177
t.deepEquals(feat, {
174178
id: "6df241c8-a9fa-4a9b-b56c-3fa0cb4af2cb",
175179
type:"Feature",
176180
properties:{
177181
type: 'u-d-f',
178-
metadata: {},
179182
archived: false,
180183
stroke: "#FF0000",
181184
'stroke-opacity': 1,
@@ -184,6 +187,9 @@ test('normalize_geojson - Polygon', async (t) => {
184187
'fill-opacity': 0.1,
185188
callsign: "New Feature",
186189
remarks: '',
190+
time: '2025-07-14T03:00:57.112Z',
191+
start: '2025-07-14T03:00:57.112Z',
192+
stale: '2025-07-14T03:00:57.112Z',
187193
center: [ -108.5260372670612, 39.08394118256409 ],
188194
metadata: {
189195
"stroke-opacity":1,

0 commit comments

Comments
 (0)