Commit 34bf1548 authored by Volker Krause's avatar Volker Krause
Browse files

Generate train station lookup table for Via Rail station codes

Possible now that the corresponding property proposal in Wikidata has
been approved.
parent 8059dde1
......@@ -40,6 +40,7 @@ bool TrainStationDbGenerator::generate(QIODevice *out)
|| !fetch("P8448", "benerail", m_benerailIdMap)
|| !fetch("P238", "iata", m_iataMap)
|| !fetch("P4803", "amtrak", m_amtrakMap)
|| !fetch("P10653", "viarail", m_viaRailMap)
|| !fetchIndianRailwaysStationCode()
|| !fetchFinishStationCodes()
) {
......@@ -68,6 +69,7 @@ namespace KnowledgeDb {
writeIdMap(out, m_benerailIdMap, "benerail", "BenerailStationId");
writeIdMap(out, m_iataMap, "iata", "IataCode");
writeIdMap(out, m_amtrakMap, "amtrak", "AmtrakStationCode");
writeIdMap(out, m_viaRailMap, "viarail", "ViaRailStationCode");
writeIndianRailwaysMap(out);
writeVRMap(out);
out->write(R"(
......@@ -404,6 +406,7 @@ void TrainStationDbGenerator::printSummary()
qDebug() << "VR (Finland) station code index:" << m_vrfiMap.size() << "elements";
qDebug() << "IATA location code index:" << m_iataMap.size() << "elements";
qDebug() << "Amtrak station code index:" << m_amtrakMap.size() << "elements";
qDebug() << "Via Rail station code index:" << m_viaRailMap.size() << "elements";
qDebug() << "Identifier collisions:" << m_idConflicts;
qDebug() << "Identifier format violations:" << m_idFormatViolations;
qDebug() << "Coordinate conflicts:" << m_coordinateConflicts;
......
......@@ -66,6 +66,7 @@ private:
std::map<KnowledgeDb::VRStationCode, QUrl> m_vrfiMap;
std::map<KnowledgeDb::IataCode, QUrl> m_iataMap;
std::map<KnowledgeDb::AmtrakStationCode, QUrl> m_amtrakMap;
std::map<KnowledgeDb::ViaRailStationCode, QUrl> m_viaRailMap;
int m_idConflicts = 0;
int m_idFormatViolations = 0;
......
......@@ -85,3 +85,5 @@ QString VRStationCode::toString() const
return s;
}
static_assert(sizeof(ViaRailStationCode) == 3);
......@@ -124,6 +124,8 @@ private:
/** Amtrak staion codes. */
using AmtrakStationCode = AlphaId<uint16_t, 3>;
/** Via Rail station code. */
using ViaRailStationCode = AlphaId<UnalignedNumber<3>, 4>;
}
}
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