Skip to content

Commit

Permalink
Fix bss imports only last osm (valhalla#3503)
Browse files Browse the repository at this point in the history
* fix bss import only last osm

* update changelog

* update changelog

* create bss_nodes once

* add log

* format

* fix test
  • Loading branch information
Patrick Qian authored Jan 7, 2022
1 parent 7a54679 commit b8ffa47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* FIXED: Stopped putting binary bytes into a string field of the protobuf TaggedValue since proto3 protects against that for cross language support [#3468](https://github.com/valhalla/valhalla/pull/3468)
* FIXED: valhalla_service uses now loki logging config instead of deprecated tyr logging [#3481](https://github.com/valhalla/valhalla/pull/3481)
* FIXED: Docker image `valhalla/valhalla:run-latest`: conan error + python integration [#3485](https://github.com/valhalla/valhalla/pull/3485)

* FIXED: Fix valhalla_build_tiles imports only bss from last osm file [#3503](https://github.com/valhalla/valhalla/pull/3503)

* **Enhancement**
* CHANGED: Pronunciation for names and destinations [#3132](https://github.com/valhalla/valhalla/pull/3132)
* CHANGED: Requested code clean up for phonemes PR [#3356](https://github.com/valhalla/valhalla/pull/3356)
Expand Down
9 changes: 8 additions & 1 deletion src/mjolnir/pbfgraphparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3149,15 +3149,22 @@ void PBFGraphParser::ParseNodes(const boost::property_tree::ptree& pt,

if (pt.get<bool>("import_bike_share_stations", false)) {
LOG_INFO("Parsing bss nodes...");

bool create = true;
for (auto& file_handle : file_handles) {
callback.current_way_node_index_ = callback.last_node_ = callback.last_way_ =
callback.last_relation_ = 0;
// we send a null way_nodes file so that only the bike share stations are parsed
callback.reset(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
new sequence<OSMNode>(bss_nodes_file, true));
new sequence<OSMNode>(bss_nodes_file, create));
OSMPBF::Parser::parse(file_handle, static_cast<OSMPBF::Interest>(OSMPBF::Interest::NODES),
callback);
create = false;
}
// Since the sequence must be flushed before reading it...
callback.reset(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
LOG_INFO("Found " + std::to_string(sequence<OSMNode>{bss_nodes_file, false}.size()) +
" bss nodes...");
}
callback.reset(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);

Expand Down

0 comments on commit b8ffa47

Please sign in to comment.