Commit 5a9ce860 authored by Volker Krause's avatar Volker Krause
Browse files

Support IFOPT ids in Hafas responses

Helps with matching Hafas results against e.g. OSM data.
parent 1718e551
Pipeline #169310 passed with stage
in 2 minutes and 5 seconds
......@@ -10,6 +10,7 @@
"expectedDepartureTime": "2021-12-12T12:30:00",
"from": {
"identifier": {
"ifopt": "de:03241:9830",
"unit-test": "8003487"
},
"latitude": 52.31689453125,
......@@ -41,6 +42,7 @@
"scheduledDepartureTime": "2021-12-12T12:30:00",
"to": {
"identifier": {
"ifopt": "de:03241:31",
"unit-test": "8000152"
},
"latitude": 52.377376556396484,
......
......@@ -9,6 +9,7 @@
#include "logging.h"
#include "datatypes/loadutil_p.h"
#include "geo/polylinedecoder_p.h"
#include "ifopt/ifoptutil.h"
#include <KPublicTransport/Journey>
#include <KPublicTransport/Platform>
......@@ -233,6 +234,16 @@ std::vector<Location> HafasMgateParser::parseLocations(const QJsonArray &locL) c
setLocationIdentifier(loc, locObj.value(QLatin1String("extId")).toString());
const auto coordObj = locObj.value(QLatin1String("crd")).toObject();
loc.setCoordinate(coordObj.value(QLatin1String("y")).toDouble() / 1000000.0, coordObj.value(QLatin1String("x")).toDouble() / 1000000.0);
const auto gidL = locObj.value(QLatin1String("gidL")).toArray();
for (const auto &gidV : gidL) {
const auto gid = gidV.toString() ;
// ### is this A× prefix actually standard or do we need to configure that per provider?
if (gid.startsWith(QStringLiteral("A×")) && IfoptUtil::isValid(QStringView(gid).mid(2))) {
loc.setIdentifier(IfoptUtil::identifierType(), gid.mid(2));
}
}
locs.push_back(loc);
}
return locs;
......
......@@ -311,7 +311,7 @@
"name": "RB/RE"
}
],
"ver": "1.21"
"ver": "1.45"
},
"supportedLanguages": [
"de",
......
......@@ -197,7 +197,7 @@
"name": "RB/RE"
}
],
"ver": "1.24"
"ver": "1.44"
},
"supportedLanguages": [
"de",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment