Deprecate .osrm file
This commit is contained in:
parent
2cf957148b
commit
c8abeb0093
@ -43,8 +43,8 @@ class ExtractionContainers
|
|||||||
void PrepareTrafficSignals(const ReferencedTrafficSignals &referenced_traffic_signals);
|
void PrepareTrafficSignals(const ReferencedTrafficSignals &referenced_traffic_signals);
|
||||||
void PrepareEdges(ScriptingEnvironment &scripting_environment);
|
void PrepareEdges(ScriptingEnvironment &scripting_environment);
|
||||||
|
|
||||||
void WriteNodes(storage::tar::FileWriter &file_out) const;
|
void WriteNodes(storage::tar::FileWriter &file_out);
|
||||||
void WriteEdges(storage::tar::FileWriter &file_out) const;
|
void WriteEdges(storage::tar::FileWriter &file_out);
|
||||||
void WriteMetadata(storage::tar::FileWriter &file_out) const;
|
void WriteMetadata(storage::tar::FileWriter &file_out) const;
|
||||||
void WriteCharData(const std::string &file_name);
|
void WriteCharData(const std::string &file_name);
|
||||||
|
|
||||||
@ -75,6 +75,8 @@ class ExtractionContainers
|
|||||||
std::vector<InputTrafficSignal> external_traffic_signals;
|
std::vector<InputTrafficSignal> external_traffic_signals;
|
||||||
TrafficSignals internal_traffic_signals;
|
TrafficSignals internal_traffic_signals;
|
||||||
|
|
||||||
|
std::vector<NodeBasedEdge> normal_edges;
|
||||||
|
|
||||||
// List of restrictions (conditional and unconditional) before we transform them into the
|
// List of restrictions (conditional and unconditional) before we transform them into the
|
||||||
// output types. Input containers reference OSMNodeIDs. We can only transform them to the
|
// output types. Input containers reference OSMNodeIDs. We can only transform them to the
|
||||||
// correct internal IDs after we've read everything. Without a multi-parse approach,
|
// correct internal IDs after we've read everything. Without a multi-parse approach,
|
||||||
@ -84,6 +86,7 @@ class ExtractionContainers
|
|||||||
|
|
||||||
std::vector<InputManeuverOverride> external_maneuver_overrides_list;
|
std::vector<InputManeuverOverride> external_maneuver_overrides_list;
|
||||||
std::vector<UnresolvedManeuverOverride> internal_maneuver_overrides;
|
std::vector<UnresolvedManeuverOverride> internal_maneuver_overrides;
|
||||||
|
std::unordered_set<NodeID> internal_barrier_nodes;
|
||||||
|
|
||||||
ExtractionContainers();
|
ExtractionContainers();
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,12 @@ class Extractor
|
|||||||
std::tuple<LaneDescriptionMap,
|
std::tuple<LaneDescriptionMap,
|
||||||
std::vector<TurnRestriction>,
|
std::vector<TurnRestriction>,
|
||||||
std::vector<UnresolvedManeuverOverride>,
|
std::vector<UnresolvedManeuverOverride>,
|
||||||
TrafficSignals>
|
TrafficSignals,
|
||||||
|
std::unordered_set<NodeID>,
|
||||||
|
std::vector<util::Coordinate>,
|
||||||
|
extractor::PackedOSMIDs,
|
||||||
|
std::vector<NodeBasedEdge>,
|
||||||
|
std::vector<NodeBasedEdgeAnnotation>>
|
||||||
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
||||||
|
|
||||||
EdgeID BuildEdgeExpandedGraph(
|
EdgeID BuildEdgeExpandedGraph(
|
||||||
|
|||||||
@ -38,11 +38,15 @@ class NodeBasedGraphFactory
|
|||||||
// node-based graph to represent the OSM network. This includes geometry compression, annotation
|
// node-based graph to represent the OSM network. This includes geometry compression, annotation
|
||||||
// data optimisation and many other aspects. After this step, the edge-based graph factory can
|
// data optimisation and many other aspects. After this step, the edge-based graph factory can
|
||||||
// turn the graph into the routing graph to be used with the navigation algorithms.
|
// turn the graph into the routing graph to be used with the navigation algorithms.
|
||||||
NodeBasedGraphFactory(const boost::filesystem::path &input_file,
|
NodeBasedGraphFactory(ScriptingEnvironment &scripting_environment,
|
||||||
ScriptingEnvironment &scripting_environment,
|
|
||||||
std::vector<TurnRestriction> &turn_restrictions,
|
std::vector<TurnRestriction> &turn_restrictions,
|
||||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||||
const TrafficSignals &traffic_signals);
|
const TrafficSignals &traffic_signals,
|
||||||
|
std::unordered_set<NodeID> barriers,
|
||||||
|
std::vector<util::Coordinate> coordinates,
|
||||||
|
extractor::PackedOSMIDs osm_node_ids,
|
||||||
|
const std::vector<NodeBasedEdge> &edge_list,
|
||||||
|
std::vector<NodeBasedEdgeAnnotation> annotation_data);
|
||||||
|
|
||||||
auto const &GetGraph() const { return compressed_output_graph; }
|
auto const &GetGraph() const { return compressed_output_graph; }
|
||||||
auto const &GetBarriers() const { return barriers; }
|
auto const &GetBarriers() const { return barriers; }
|
||||||
@ -60,9 +64,8 @@ class NodeBasedGraphFactory
|
|||||||
void ReleaseOsmNodes();
|
void ReleaseOsmNodes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Get the information from the *.osrm file (direct product of the extractor callback/extraction
|
// Build and validate compressed output graph
|
||||||
// containers) and prepare the graph creation process
|
void BuildCompressedOutputGraph(const std::vector<NodeBasedEdge> &edge_list);
|
||||||
void LoadDataFromFile(const boost::filesystem::path &input_file);
|
|
||||||
|
|
||||||
// Compress the node-based graph into a compact representation of itself. This removes storing a
|
// Compress the node-based graph into a compact representation of itself. This removes storing a
|
||||||
// single edge for every part of the geometry and might also combine meta-data for multiple
|
// single edge for every part of the geometry and might also combine meta-data for multiple
|
||||||
|
|||||||
@ -806,9 +806,9 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractionContainers::WriteEdges(storage::tar::FileWriter &writer) const
|
void ExtractionContainers::WriteEdges(storage::tar::FileWriter &writer)
|
||||||
{
|
{
|
||||||
std::vector<NodeBasedEdge> normal_edges;
|
// std::vector<NodeBasedEdge> normal_edges;
|
||||||
normal_edges.reserve(all_edges_list.size());
|
normal_edges.reserve(all_edges_list.size());
|
||||||
{
|
{
|
||||||
util::UnbufferedLog log;
|
util::UnbufferedLog log;
|
||||||
@ -854,7 +854,7 @@ void ExtractionContainers::WriteMetadata(storage::tar::FileWriter &writer) const
|
|||||||
log << " -- Metadata contains << " << all_edges_annotation_data_list.size() << " entries.";
|
log << " -- Metadata contains << " << all_edges_annotation_data_list.size() << " entries.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractionContainers::WriteNodes(storage::tar::FileWriter &writer) const
|
void ExtractionContainers::WriteNodes(storage::tar::FileWriter &writer)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
util::UnbufferedLog log;
|
util::UnbufferedLog log;
|
||||||
@ -900,17 +900,16 @@ void ExtractionContainers::WriteNodes(storage::tar::FileWriter &writer) const
|
|||||||
util::UnbufferedLog log;
|
util::UnbufferedLog log;
|
||||||
log << "Writing barrier nodes ... ";
|
log << "Writing barrier nodes ... ";
|
||||||
TIMER_START(write_nodes);
|
TIMER_START(write_nodes);
|
||||||
std::vector<NodeID> internal_barrier_nodes;
|
|
||||||
for (const auto osm_id : barrier_nodes)
|
for (const auto osm_id : barrier_nodes)
|
||||||
{
|
{
|
||||||
const auto node_id = mapExternalToInternalNodeID(
|
const auto node_id = mapExternalToInternalNodeID(
|
||||||
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
|
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
|
||||||
if (node_id != SPECIAL_NODEID)
|
if (node_id != SPECIAL_NODEID)
|
||||||
{
|
{
|
||||||
internal_barrier_nodes.push_back(node_id);
|
internal_barrier_nodes.emplace(node_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storage::serialization::write(writer, "/extractor/barriers", internal_barrier_nodes);
|
// storage::serialization::write(writer, "/extractor/barriers", internal_barrier_nodes);
|
||||||
log << "ok, after " << TIMER_SEC(write_nodes) << "s";
|
log << "ok, after " << TIMER_SEC(write_nodes) << "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -208,8 +208,21 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
std::vector<TurnRestriction> turn_restrictions;
|
std::vector<TurnRestriction> turn_restrictions;
|
||||||
std::vector<UnresolvedManeuverOverride> unresolved_maneuver_overrides;
|
std::vector<UnresolvedManeuverOverride> unresolved_maneuver_overrides;
|
||||||
TrafficSignals traffic_signals;
|
TrafficSignals traffic_signals;
|
||||||
std::tie(turn_lane_map, turn_restrictions, unresolved_maneuver_overrides, traffic_signals) =
|
std::unordered_set<NodeID> barriers;
|
||||||
ParseOSMData(scripting_environment, number_of_threads);
|
std::vector<util::Coordinate> osm_coordinates;
|
||||||
|
extractor::PackedOSMIDs osm_node_ids;
|
||||||
|
std::vector<NodeBasedEdge> edge_list;
|
||||||
|
std::vector<NodeBasedEdgeAnnotation> annotation_data;
|
||||||
|
|
||||||
|
std::tie(turn_lane_map,
|
||||||
|
turn_restrictions,
|
||||||
|
unresolved_maneuver_overrides,
|
||||||
|
traffic_signals,
|
||||||
|
barriers,
|
||||||
|
osm_coordinates,
|
||||||
|
osm_node_ids,
|
||||||
|
edge_list,
|
||||||
|
annotation_data) = ParseOSMData(scripting_environment, number_of_threads);
|
||||||
|
|
||||||
// Transform the node-based graph that OSM is based on into an edge-based graph
|
// Transform the node-based graph that OSM is based on into an edge-based graph
|
||||||
// that is better for routing. Every edge becomes a node, and every valid
|
// that is better for routing. Every edge becomes a node, and every valid
|
||||||
@ -227,11 +240,15 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
std::uint32_t ebg_connectivity_checksum = 0;
|
std::uint32_t ebg_connectivity_checksum = 0;
|
||||||
|
|
||||||
// Create a node-based graph from the OSRM file
|
// Create a node-based graph from the OSRM file
|
||||||
NodeBasedGraphFactory node_based_graph_factory(config.GetPath(".osrm"),
|
NodeBasedGraphFactory node_based_graph_factory(scripting_environment,
|
||||||
scripting_environment,
|
|
||||||
turn_restrictions,
|
turn_restrictions,
|
||||||
unresolved_maneuver_overrides,
|
unresolved_maneuver_overrides,
|
||||||
traffic_signals);
|
traffic_signals,
|
||||||
|
std::move(barriers),
|
||||||
|
std::move(osm_coordinates),
|
||||||
|
std::move(osm_node_ids),
|
||||||
|
edge_list,
|
||||||
|
std::move(annotation_data));
|
||||||
|
|
||||||
NameTable name_table;
|
NameTable name_table;
|
||||||
files::readNames(config.GetPath(".osrm.names"), name_table);
|
files::readNames(config.GetPath(".osrm.names"), name_table);
|
||||||
@ -364,7 +381,12 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
std::tuple<LaneDescriptionMap,
|
std::tuple<LaneDescriptionMap,
|
||||||
std::vector<TurnRestriction>,
|
std::vector<TurnRestriction>,
|
||||||
std::vector<UnresolvedManeuverOverride>,
|
std::vector<UnresolvedManeuverOverride>,
|
||||||
TrafficSignals>
|
TrafficSignals,
|
||||||
|
std::unordered_set<NodeID>,
|
||||||
|
std::vector<util::Coordinate>,
|
||||||
|
extractor::PackedOSMIDs,
|
||||||
|
std::vector<NodeBasedEdge>,
|
||||||
|
std::vector<NodeBasedEdgeAnnotation>>
|
||||||
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||||
const unsigned number_of_threads)
|
const unsigned number_of_threads)
|
||||||
{
|
{
|
||||||
@ -629,10 +651,31 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
|||||||
TIMER_STOP(extracting);
|
TIMER_STOP(extracting);
|
||||||
util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s";
|
util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s";
|
||||||
|
|
||||||
|
std::unordered_set<NodeID> barriers;
|
||||||
|
std::vector<util::Coordinate> osm_coordinates;
|
||||||
|
extractor::PackedOSMIDs osm_node_ids;
|
||||||
|
std::vector<NodeBasedEdge> edge_list;
|
||||||
|
std::vector<NodeBasedEdgeAnnotation> annotation_data;
|
||||||
|
|
||||||
|
osm_coordinates.resize(extraction_containers.all_nodes_list.size());
|
||||||
|
osm_node_ids.reserve(extraction_containers.all_nodes_list.size());
|
||||||
|
for (size_t index = 0; index < extraction_containers.all_nodes_list.size(); ++index)
|
||||||
|
{
|
||||||
|
const auto ¤t_node = extraction_containers.all_nodes_list[index];
|
||||||
|
osm_coordinates[index].lon = current_node.lon;
|
||||||
|
osm_coordinates[index].lat = current_node.lat;
|
||||||
|
osm_node_ids.push_back(current_node.node_id);
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_tuple(std::move(turn_lane_map),
|
return std::make_tuple(std::move(turn_lane_map),
|
||||||
std::move(extraction_containers.turn_restrictions),
|
std::move(extraction_containers.turn_restrictions),
|
||||||
std::move(extraction_containers.internal_maneuver_overrides),
|
std::move(extraction_containers.internal_maneuver_overrides),
|
||||||
std::move(extraction_containers.internal_traffic_signals));
|
std::move(extraction_containers.internal_traffic_signals),
|
||||||
|
std::move(extraction_containers.internal_barrier_nodes),
|
||||||
|
std::move(osm_coordinates),
|
||||||
|
std::move(osm_node_ids),
|
||||||
|
std::move(extraction_containers.normal_edges),
|
||||||
|
std::move(extraction_containers.all_edges_annotation_data_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Extractor::FindComponents(unsigned number_of_edge_based_nodes,
|
void Extractor::FindComponents(unsigned number_of_edge_based_nodes,
|
||||||
|
|||||||
@ -16,32 +16,30 @@ namespace extractor
|
|||||||
{
|
{
|
||||||
|
|
||||||
NodeBasedGraphFactory::NodeBasedGraphFactory(
|
NodeBasedGraphFactory::NodeBasedGraphFactory(
|
||||||
const boost::filesystem::path &input_file,
|
|
||||||
ScriptingEnvironment &scripting_environment,
|
ScriptingEnvironment &scripting_environment,
|
||||||
std::vector<TurnRestriction> &turn_restrictions,
|
std::vector<TurnRestriction> &turn_restrictions,
|
||||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||||
const TrafficSignals &traffic_signals)
|
const TrafficSignals &traffic_signals,
|
||||||
|
std::unordered_set<NodeID> barriers,
|
||||||
|
std::vector<util::Coordinate> coordinates,
|
||||||
|
extractor::PackedOSMIDs osm_node_ids,
|
||||||
|
const std::vector<NodeBasedEdge> &edge_list,
|
||||||
|
std::vector<NodeBasedEdgeAnnotation> annotation_data)
|
||||||
|
: annotation_data(std::move(annotation_data)), barriers(std::move(barriers)),
|
||||||
|
coordinates(std::move(coordinates)), osm_node_ids(std::move(osm_node_ids))
|
||||||
{
|
{
|
||||||
LoadDataFromFile(input_file);
|
BuildCompressedOutputGraph(edge_list);
|
||||||
Compress(scripting_environment, turn_restrictions, maneuver_overrides, traffic_signals);
|
Compress(scripting_environment, turn_restrictions, maneuver_overrides, traffic_signals);
|
||||||
CompressGeometry();
|
CompressGeometry();
|
||||||
CompressAnnotationData();
|
CompressAnnotationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the data serialised during the extraction run
|
void NodeBasedGraphFactory::BuildCompressedOutputGraph(const std::vector<NodeBasedEdge> &edge_list)
|
||||||
void NodeBasedGraphFactory::LoadDataFromFile(const boost::filesystem::path &input_file)
|
|
||||||
{
|
{
|
||||||
auto barriers_iter = inserter(barriers, end(barriers));
|
|
||||||
std::vector<NodeBasedEdge> edge_list;
|
|
||||||
|
|
||||||
files::readRawNBGraph(
|
|
||||||
input_file, barriers_iter, coordinates, osm_node_ids, edge_list, annotation_data);
|
|
||||||
|
|
||||||
const auto number_of_node_based_nodes = coordinates.size();
|
const auto number_of_node_based_nodes = coordinates.size();
|
||||||
if (edge_list.empty())
|
if (edge_list.empty())
|
||||||
{
|
{
|
||||||
throw util::exception("Node-based-graph (" + input_file.string() + ") contains no edges." +
|
throw util::exception("Node-based-graph contains no edges." + SOURCE_REF);
|
||||||
SOURCE_REF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// at this point, the data isn't compressed, but since we update the graph in-place, we assign
|
// at this point, the data isn't compressed, but since we update the graph in-place, we assign
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user