2024-02-06 22:58:49 +01:00
|
|
|
|
const dhidPrefix = 'A×';
|
2022-03-07 01:34:33 +01:00
|
|
|
|
|
|
|
|
|
const parseAndAddLocationDHID = (loc, l) => {
|
2024-02-06 22:58:49 +01:00
|
|
|
|
if (!Array.isArray(l.gidL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-03-07 01:34:33 +01:00
|
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
|
const dhidGid = l.gidL.find(gid => gid.slice(0, dhidPrefix.length) === dhidPrefix);
|
|
|
|
|
if (!dhidGid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const dhid = dhidGid.slice(dhidPrefix.length);
|
2022-03-07 01:34:33 +01:00
|
|
|
|
|
|
|
|
|
// It seems that the DHID of the parent station is being used, not of the stop.
|
|
|
|
|
// if (!loc.ids) loc.ids = {}
|
|
|
|
|
// loc.ids.dhid = dhid
|
2022-10-24 17:29:23 +02:00
|
|
|
|
// todo: use loc.ids.stationDHID instead?
|
2024-02-06 22:58:49 +01:00
|
|
|
|
loc.stationDHID = dhid;
|
|
|
|
|
};
|
2022-03-07 01:34:33 +01:00
|
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
|
export {
|
|
|
|
|
parseAndAddLocationDHID,
|
2024-02-06 22:58:49 +01:00
|
|
|
|
};
|