It contains original graph nodes (coordinates and OSM node IDs indexed by NBG NodeID).
tar -tvf nevada-latest.osrm.nbg_nodes
osrm_fingerprint.meta
/common/nbn_data/coordinates.meta
/common/nbn_data/coordinates
/common/nbn_data/osm_node_ids/number_of_elements.meta
/common/nbn_data/osm_node_ids/packed.meta
/common/nbn_data/osm_node_ids/packed
Stores coordinates of all used OSM Nodes.
The coordinates are totally the same with coordinates stores in .osrm - /extractor/nodes.
The first step in NodeBasedGraphFactory is loading data from .osrm
file. It calls NodeBasedGraphFactory::LoadDataFromFile() for the loading. Below code block shows the reading from /extractor/nodes
of .osrm
, which comes from the subcall readRawNBGraph(). It constructs the coordinates
member(std::vector<util::Coordinate> coordinates;
) of the NodeBasedGraphFactory object.
auto number_of_nodes = reader.ReadElementCount64("/extractor/nodes");
coordinates.resize(number_of_nodes);
osm_node_ids.reserve(number_of_nodes);
auto index = 0;
auto decode = [&](const auto ¤t_node) {
// [Jay] constructs `coordinates`
coordinates[index].lon = current_node.lon;
coordinates[index].lat = current_node.lat;
osm_node_ids.push_back(current_node.node_id);
index++;
};
reader.ReadStreaming<extractor::QueryNode>("/extractor/nodes",
boost::make_function_output_iterator(decode));
The Coordinate structure definition:
struct Coordinate
{
FixedLongitude lon;
FixedLatitude lat;
}
Once NodeBasedGraphFactory object constructed, the coordinates
will be written into .osrm.nbg_nodes
file as below(link).
util::Log() << "Writing nodes for nodes-based and edges-based graphs ...";
auto const &coordinates = node_based_graph_factory.GetCoordinates();
files::writeNodes(
config.GetPath(".osrm.nbg_nodes"), coordinates, node_based_graph_factory.GetOsmNodes());
node_based_graph_factory.ReleaseOsmNodes();
Stores original NodeIDs of all used OSM Nodes.
The NodeIDs are totally the same with OSM NodeIDs stores in .osrm - /extractor/nodes. The only difference is they're packed(a.k.a compressed) in storage. Each 64 bits NodeID will be packed into smaller size, which is 33 bits in osrm/osrm-backend but 63 bits in telenav/osrm-backend. The packed_vector
is designed for this pack action, refer to osrm/doc/packed_vector.md for more explaination. The packed_vector
structure will be written to below 3 files.
/common/nbn_data/osm_node_ids/number_of_elements.meta
/common/nbn_data/osm_node_ids/packed
/common/nbn_data/osm_node_ids/packed.meta
Both the osm_node_ids
construction and written are the same with /common/nbn_data/coordinates, /common/nbn_data/coordinates.meta, refer to /common/nbn_data/coordinates, /common/nbn_data/coordinates.meta - Implementation for details.