Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix speed field #58

Merged
merged 3 commits into from
Aug 19, 2024
Merged
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
11 changes: 6 additions & 5 deletions dev/osm2gmns_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ int main(int /*argc*/, char* /*argv*/[]) {
absl::InitializeLog();
absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);

// const auto map_folder = std::filesystem::path("dev/maps/District_of_Columbia");
const auto map_folder = std::filesystem::path("dev/maps/District_of_Columbia");
// const auto map_folder = std::filesystem::path("dev/maps/gatech");
const auto map_folder = std::filesystem::path("dev/maps/debug");
// const auto map_folder = std::filesystem::path("dev/maps/Ile-de-France");
// const auto map_folder = std::filesystem::path("dev/maps/debug");

// const std::string map_filename = "map.osm.pbf";
const std::string map_filename = "illinois-latest.osm.pbf";
const std::string map_filename = "map.osm.pbf";
// const std::string map_filename = "illinois-latest.osm.pbf";
// const std::string map_filename = "map.osm";

Network* network = getNetFromFile(map_folder / map_filename, {ModeType::AUTO},
Expand All @@ -36,7 +37,7 @@ int main(int /*argc*/, char* /*argv*/[]) {

// consolidateComplexIntersections(network, true);

generateNodeActivityInfo(network);
// generateNodeActivityInfo(network);

// fillLinkAttributesWithDefaultValues(network, true, {}, false, {{HighWayLinkType::MOTORWAY, 1}}, true,
// {{HighWayLinkType::MOTORWAY, 1}});
Expand Down
1 change: 1 addition & 0 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
#define OSM2GMNS_CONSTANTS_H

constexpr double MICROSECONDS_TO_SECOND = 1e-6;
constexpr float MPH_TO_KPH = 1.609;

#endif // OSM2GMNS_CONSTANTS_H
3 changes: 2 additions & 1 deletion src/osmnetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ void OsmWay::configAttributes() {
if (!max_speed_raw_.empty()) {
std::smatch match;
if (std::regex_search(max_speed_raw_, match, getFloatNumMatchingPattern())) {
max_speed_ = std::stof(match.str());
max_speed_ = absl::StrContains(max_speed_raw_, "mph") ? std::round(std::stof(match.str()) * MPH_TO_KPH)
: std::stof(match.str());
}
}

Expand Down
Loading