| 30 | } // namespace |
| 31 | |
| 32 | WikidataHelper::WikidataHelper(std::string const & mwmPath, std::string const & idToWikidataPath) |
| 33 | { |
| 34 | if (idToWikidataPath.empty()) |
| 35 | return; |
| 36 | |
| 37 | std::string const osmIdsToFeatureIdsPath = mwmPath + OSM2FEATURE_FILE_EXTENSION; |
| 38 | if (!ParseFeatureIdToOsmIdMapping(osmIdsToFeatureIdsPath, m_featureIdToOsmId)) |
| 39 | LOG(LCRITICAL, ("Mapping parse error for file ", osmIdsToFeatureIdsPath)); |
| 40 | |
| 41 | std::ifstream stream(idToWikidataPath); |
| 42 | if (!stream) |
| 43 | LOG(LERROR, ("File ", idToWikidataPath, " not found. Consider skipping Descriptions stage.")); |
| 44 | stream.exceptions(std::fstream::badbit); |
| 45 | |
| 46 | uint64_t id; |
| 47 | std::string wikidataId; |
| 48 | while (stream) |
| 49 | { |
| 50 | stream >> id >> wikidataId; |
| 51 | strings::Trim(wikidataId); |
| 52 | m_osmIdToWikidataId.emplace(base::GeoObjectId(id), wikidataId); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | std::optional<std::string> WikidataHelper::GetWikidataId(uint32_t featureId) const |
| 57 | { |
nothing calls this directly
no test coverage detected