@golemio/ndic 1.4.2 → 1.4.3-dev.1746398978
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.
|
@@ -8,5 +8,7 @@ export declare class OsmPathService {
|
|
|
8
8
|
private logger;
|
|
9
9
|
constructor(globalNetworkMappingRepository: GlobalNetworkMappingRepository, rsdTmcOsmMappingRepository: RsdTmcOsmMappingRepository, logger: ILogger);
|
|
10
10
|
addOsmPath(transformedData: ITrafficRestrictionsModel[]): Promise<ITrafficRestrictionsModel[]>;
|
|
11
|
+
private getOsmPathGlobalNetworkMethod;
|
|
12
|
+
private getOsmPathAlertCLinearMethod;
|
|
11
13
|
private getGlobalNetworkSectionIds;
|
|
12
14
|
}
|
|
@@ -24,30 +24,9 @@ let OsmPathService = exports.OsmPathService = class OsmPathService {
|
|
|
24
24
|
for (let index = 0; index < transformedData.length; index++) {
|
|
25
25
|
const record = transformedData[index];
|
|
26
26
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (ltStart === "0") {
|
|
31
|
-
// handles special case for freeway ramps
|
|
32
|
-
ltStart = ltEnd;
|
|
33
|
-
}
|
|
34
|
-
else if (ltEnd === "0") {
|
|
35
|
-
ltEnd = ltStart;
|
|
36
|
-
}
|
|
37
|
-
const osmPath = await this.rsdTmcOsmMappingRepository.GetOne({
|
|
38
|
-
ltStart: Number(ltStart),
|
|
39
|
-
ltEnd: Number(ltEnd),
|
|
40
|
-
});
|
|
41
|
-
record.osm_path = osmPath ? [osmPath] : undefined;
|
|
42
|
-
}
|
|
43
|
-
if (!record.osm_path && record.global_network_linear) {
|
|
44
|
-
const roadIds = this.getGlobalNetworkSectionIds(record);
|
|
45
|
-
// global_network_linear, currently we do not differentiate between positive and negative direction
|
|
46
|
-
const result = await this.globalNetworkMappingRepository.findAll(roadIds);
|
|
47
|
-
record.osm_path = result.map((element) => element.osm_path.split(",").map((text) => +text));
|
|
48
|
-
if (record.osm_path.length === 0) {
|
|
49
|
-
record.osm_path = undefined;
|
|
50
|
-
}
|
|
27
|
+
record.osm_path = await this.getOsmPathGlobalNetworkMethod(record);
|
|
28
|
+
if (!record.osm_path) {
|
|
29
|
+
record.osm_path = await this.getOsmPathAlertCLinearMethod(record);
|
|
51
30
|
}
|
|
52
31
|
}
|
|
53
32
|
catch (error) {
|
|
@@ -63,6 +42,38 @@ let OsmPathService = exports.OsmPathService = class OsmPathService {
|
|
|
63
42
|
}
|
|
64
43
|
return transformedData;
|
|
65
44
|
}
|
|
45
|
+
async getOsmPathGlobalNetworkMethod(record) {
|
|
46
|
+
if (record.global_network_linear) {
|
|
47
|
+
const roadIds = this.getGlobalNetworkSectionIds(record);
|
|
48
|
+
// global_network_linear, currently we do not differentiate between positive and negative direction
|
|
49
|
+
const result = await this.globalNetworkMappingRepository.findAll(roadIds);
|
|
50
|
+
const osmPath = result.map((element) => element.osm_path.split(",").map((text) => +text));
|
|
51
|
+
if (osmPath.length !== 0) {
|
|
52
|
+
return osmPath;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
async getOsmPathAlertCLinearMethod(record) {
|
|
58
|
+
if (record.alert_c_linear) {
|
|
59
|
+
let ltStart = record.alert_c_linear?.alertCMethod2SecondaryPointLocation.alertCLocation.specificLocation || null;
|
|
60
|
+
let ltEnd = record.alert_c_linear?.alertCMethod2PrimaryPointLocation.alertCLocation.specificLocation || null;
|
|
61
|
+
if (ltStart === "0") {
|
|
62
|
+
// handles special case for freeway ramps
|
|
63
|
+
ltStart = ltEnd;
|
|
64
|
+
}
|
|
65
|
+
else if (ltEnd === "0") {
|
|
66
|
+
ltEnd = ltStart;
|
|
67
|
+
}
|
|
68
|
+
const osmPath = await this.rsdTmcOsmMappingRepository.GetOne({
|
|
69
|
+
ltStart: Number(ltStart),
|
|
70
|
+
ltEnd: Number(ltEnd),
|
|
71
|
+
});
|
|
72
|
+
const reversedOsmPath = osmPath ? [...osmPath].reverse() : undefined;
|
|
73
|
+
return osmPath && reversedOsmPath ? [osmPath, reversedOsmPath] : undefined;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
66
77
|
getGlobalNetworkSectionIds(record) {
|
|
67
78
|
// if array
|
|
68
79
|
if (Array.isArray(record.global_network_linear.linearWithinLinearGNElement)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OsmPathService.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/OsmPathService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iGAA+F;AAG/F,6EAA8F;AAC9F,iEAAgE;AAChE,wIAAqI;AAG9H,IAAM,cAAc,4BAApB,MAAM,cAAc;IACvB,YACY,8BAA8D,EAC9D,0BAAsD,EACtD,MAAe;QAFf,mCAA8B,GAA9B,8BAA8B,CAAgC;QAC9D,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,WAAM,GAAN,MAAM,CAAS;IACxB,CAAC;IAEG,KAAK,CAAC,UAAU,CAAC,eAA4C;QAChE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACzD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI;gBACA,
|
|
1
|
+
{"version":3,"file":"OsmPathService.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/OsmPathService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iGAA+F;AAG/F,6EAA8F;AAC9F,iEAAgE;AAChE,wIAAqI;AAG9H,IAAM,cAAc,4BAApB,MAAM,cAAc;IACvB,YACY,8BAA8D,EAC9D,0BAAsD,EACtD,MAAe;QAFf,mCAA8B,GAA9B,8BAA8B,CAAgC;QAC9D,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,WAAM,GAAN,MAAM,CAAS;IACxB,CAAC;IAEG,KAAK,CAAC,UAAU,CAAC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AAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACxG;QACD,YAAY;QACZ,OAAO,CAAC,MAAM,CAAC,qBAAsB,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACjF,CAAC;CACJ,CAAA;yBAlFY,cAAc;IAD1B,IAAA,qBAAU,GAAE;qCAGmC,+DAA8B;QAClC,uDAA0B;GAHzD,cAAc,CAkF1B"}
|
|
@@ -95,6 +95,7 @@ Worker slouží pro zpracování příchozích dat NdicTrafficInfo a NdicTraffic
|
|
|
95
95
|
- [odkaz na transformaci dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/src/integration-engine/transformations/TrafficRestrictionsTransformation.ts)
|
|
96
96
|
- (volitelně) obohacení dat
|
|
97
97
|
- stejné jako u předešlé metody *`saveTrafficInfo`*
|
|
98
|
+
- osm path se obohacuje nejdříve pomocí global network lookup tabulky (viz `RefreshGlobalNetworkDataTask`) a pokud se to nepodaří, tak získáme osmpath pomocí `ltstart` a `ltend` z `rsdTmcPointsModel` (modul traffic common)
|
|
98
99
|
- data modely
|
|
99
100
|
- `ndicTrafficRestrictionsModel` se ukládá do tabulky ndic_traffic_restrictions
|
|
100
101
|
|
|
@@ -110,6 +111,7 @@ Worker slouží pro zpracování příchozích dat NdicTrafficInfo a NdicTraffic
|
|
|
110
111
|
- [odkaz na transformaci dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/src/integration-engine/transformations/TrafficRestrictionsTransformation.ts)
|
|
111
112
|
- (volitelně) obohacení dat
|
|
112
113
|
- stejné jako u předešlé metody *`saveTrafficInfo`*
|
|
114
|
+
- osm path se obohacuje nejdříve pomocí global network lookup tabulky (viz `RefreshGlobalNetworkDataTask`) a pokud se to nepodaří, tak získáme osmpath pomocí `ltstart` a `ltend` z `rsdTmcPointsModel` (modul traffic common)
|
|
113
115
|
- repository
|
|
114
116
|
- ukládá do tabulky `ndic_traffic_restrictions_regions`
|
|
115
117
|
- předpis stejný jako u saveTrafficRestrictions
|