Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ target_link_libraries(osr
add_executable(osr-extract exe/extract.cc)
target_link_libraries(osr-extract osr)

add_executable(osr-preprocessing exe/preprocessing.cc)
target_link_libraries(osr-preprocessing osr)

add_executable(osr-benchmark exe/benchmark.cc)
target_link_libraries(osr-benchmark osr)

Expand Down
11 changes: 11 additions & 0 deletions exe/backend/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#include "osr/elevation_storage.h"
#include "osr/lookup.h"
#include "osr/platforms.h"
#include "osr/preprocessing/contraction_hierarchy/shortcut_storage.h"
#include "osr/routing/profile.h"
#include "osr/routing/profiles/car.h"
#include "osr/ways.h"

namespace fs = std::filesystem;
Expand Down Expand Up @@ -78,6 +81,14 @@ int main(int argc, char const* argv[]) {
}

auto const w = ways{opt.data_dir_, cista::mmap::protection::READ};
if (auto const f_name =
shortcut_storage<car::node>::get_filename(search_profile::kCar);
fs::exists(fs::path{opt.data_dir_} / f_name)) {
get_shortcut_storage<car::node>() =
shortcut_storage<car::node>::read(opt.data_dir_, search_profile::kCar);
} else {
fmt::println("{} not found. Shortcuts won't be available", f_name);
}

auto const platforms_check_path = opt.data_dir_ / "node_is_platform.bin";
if (!fs::exists(platforms_check_path)) {
Expand Down
6 changes: 3 additions & 3 deletions exe/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ int main(int argc, char const* argv[]) {

auto const ends = set_end<P>(params, b, w, end);
auto const start_time = std::chrono::steady_clock::now();
d.template run<direction::kForward, false>(
d.template run<direction::kForward, adj_conf::kNone>(
params, w, *w.r_, opt.max_dist_, nullptr, nullptr,
elevations.get());
elevations.get(), nullptr, node_idx_t::invalid());
auto const middle_time = std::chrono::steady_clock::now();
b.template run<direction::kForward, false>(
b.template run<direction::kForward, adj_conf::kNone>(
params, w, *w.r_, opt.max_dist_, nullptr, nullptr,
elevations.get());
auto const end_time = std::chrono::steady_clock::now();
Expand Down
71 changes: 71 additions & 0 deletions exe/preprocessing.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <iostream>

#include "fmt/std.h"

#include "conf/options_parser.h"

#include "utl/progress_tracker.h"

#include "osr/preprocessing/contraction_hierarchy/contraction.h"
#include "osr/preprocessing/contraction_hierarchy/node_order.h"
#include "osr/routing/parameters.h"
#include "osr/routing/profile.h"
#include "osr/routing/profiles/car.h"
#include "osr/types.h"

using namespace osr;
using namespace boost::program_options;
namespace fs = std::filesystem;

struct config : public conf::configuration {
config(std::filesystem::path dir,
size_t const seed,
cost_t const detour_limit,
std::string const& method)
: configuration{"Options"},
dir_{std::move(dir)},
seed_(seed),
detour_limit_(detour_limit),
ordering_method_(method) {
param(dir_, "folder,f",
"directory of extracted data and to save shortcuts to");
param(seed_, "seed,s",
"(optional) the seed to for random node ordering (default: 1337)");
param(detour_limit_, "detour,d",
"(optional) max feasible cost to detour turning restrictions "
"(default: 10 min)");
param(ordering_method_, "method,m",
"(optional) the method to order the nodes: random, real (orders by "
"OSM metadata) (default: real)");
}

std::filesystem::path dir_;
size_t seed_;
cost_t detour_limit_;
std::string ordering_method_;
};

int main(int ac, char const** av) {
auto c = config{"", 1337, 10 * 60U, "real"};

conf::options_parser parser({&c});
parser.read_command_line_args(ac, av);

parser.read_configuration_file();

parser.print_unrecognized(std::cout);
parser.print_used(std::cout);

if (!fs::is_directory(c.dir_)) {
fmt::println("input extract directory {} not found", c.dir_);
return 1;
}

utl::activate_progress_tracker("osr-preprocessing");
auto const silencer = utl::global_progress_bars{false};

preprocess_ch<car>(
c.dir_, search_profile::kCar,
std::get<car::parameters>(get_parameters(search_profile::kCar)), c.seed_,
c.detour_limit_, node_order::string2method(c.ordering_method_));
}
1 change: 1 addition & 0 deletions include/osr/geojson.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ struct geojson_writer {
{"car", p.is_car_accessible()},
{"bike", p.is_bike_accessible()},
{"foot", p.is_walk_accessible()},
{"importance", p.importance()},
{"is_restricted", w_.r_->node_is_restricted_[n]},
{"is_entrance", p.is_entrance()},
{"is_elevator", p.is_elevator()},
Expand Down
Loading
Loading