diff --git a/include/osr/ways.h b/include/osr/ways.h index 163403c..b3ca11a 100644 --- a/include/osr/ways.h +++ b/include/osr/ways.h @@ -183,6 +183,8 @@ struct ways { return cista::mmap{(p_ / file).generic_string().c_str(), mode_}; } + void sync(); + way_idx_t::value_t n_ways() const { return way_osm_idx_.size(); } node_idx_t::value_t n_nodes() const { return node_to_osm_.size(); } diff --git a/src/extract.cc b/src/extract.cc index b55708c..cd206fa 100644 --- a/src/extract.cc +++ b/src/extract.cc @@ -558,6 +558,9 @@ void extract(bool const with_platforms, reader.close(); } + w.r_->write(out); + w.sync(); + w.connect_ways(); auto r = std::vector{}; diff --git a/src/ways.cc b/src/ways.cc index 5782453..e183e27 100644 --- a/src/ways.cc +++ b/src/ways.cc @@ -141,6 +141,18 @@ void ways::connect_ways() { std::filesystem::remove(p_ / "tmp_node_in_way_idx_index.bin", e); } +void ways::sync() { + node_to_osm_.mmap_.sync(); + way_osm_idx_.mmap_.sync(); + way_polylines_.data_.mmap_.sync(); + way_polylines_.bucket_starts_.mmap_.sync(); + way_osm_nodes_.data_.mmap_.sync(); + way_osm_nodes_.bucket_starts_.mmap_.sync(); + strings_.data_.mmap_.sync(); + strings_.bucket_starts_.mmap_.sync(); + way_names_.mmap_.sync(); +} + cista::wrapped ways::routing::read( std::filesystem::path const& p) { return cista::read(p / "routing.bin");