-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Do not generate intermediate .osrm file in osrm-extract. #6354
Changes from 16 commits
c8abeb0
237d794
af8059f
5fab7ba
8e6d018
1648b9c
e17fa9d
09ca325
156e5a9
13245be
1b940a6
1bb75f8
500ea83
a96cb23
c3be71a
bbfff7d
fd8ccde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -124,7 +124,19 @@ jobs: | |||||||
# when `--memory-swap` value equals `--memory` it means container won't use swap | ||||||||
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details | ||||||||
MEMORY_ARGS="--memory=1g --memory-swap=1g" | ||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf | ||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf | ||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm /data/berlin-latest.geojson | ||||||||
if [ ! -s "${PWD}/berlin-latest.geojson" ] | ||||||||
then | ||||||||
>&2 echo "No berlin-latest.geojson found" | ||||||||
exit 1 | ||||||||
fi | ||||||||
|
||||||||
# here we check that `osrm-partition` accepts base file path with `.osrm` extension even if `.osrm` file doesn't exist | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed the command args refer to the osrm-backend/src/tools/customize.cpp Lines 78 to 80 in 41dda32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated it |
||||||||
# this way we check backward compatibility with existing pipelines which may rely on it | ||||||||
rm -rf "${PWD}/berlin-latest.osrm" | ||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm | ||||||||
|
||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm | ||||||||
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm | ||||||||
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm & | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker con | |
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/berlin-latest.osrm | ||
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/berlin-latest.osrm | ||
|
||
Note that `berlin-latest.osrm` has a different file extension. | ||
Note there is no `berlin-latest.osrm` file, but multiple `berlin-latest.osrm.*` files, i.e. `berlin-latest.osrm` is not file path, but "base" path referring to set of files and there is an option to omit this `.osrm` suffix completely(e.g. `osrm-partition /data/berlin-latest`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mjjbell I noticed that all our files match There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, agreed. |
||
|
||
docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,14 +60,25 @@ class Extractor | |
Extractor(ExtractorConfig extractor_config) : config(std::move(extractor_config)) {} | ||
int run(ScriptingEnvironment &scripting_environment); | ||
|
||
private: | ||
struct ParsedOSMData | ||
{ | ||
LaneDescriptionMap turn_lane_map; | ||
std::vector<TurnRestriction> turn_restrictions; | ||
std::vector<UnresolvedManeuverOverride> unresolved_maneuver_overrides; | ||
TrafficSignals traffic_signals; | ||
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; | ||
}; | ||
|
||
private: | ||
ExtractorConfig config; | ||
|
||
std::tuple<LaneDescriptionMap, | ||
std::vector<TurnRestriction>, | ||
std::vector<UnresolvedManeuverOverride>, | ||
TrafficSignals> | ||
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads); | ||
ParsedOSMData ParseOSMData(ScriptingEnvironment &scripting_environment, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this |
||
const unsigned number_of_threads); | ||
|
||
EdgeID BuildEdgeExpandedGraph( | ||
// input data | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,15 +34,19 @@ namespace extractor | |
class NodeBasedGraphFactory | ||
{ | ||
public: | ||
// The node-based graph factory loads the *.osrm file and transforms the data within into the | ||
// The node-based graph factory transforms the graph data into the | ||
// 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 | ||
// turn the graph into the routing graph to be used with the navigation algorithms. | ||
NodeBasedGraphFactory(const boost::filesystem::path &input_file, | ||
ScriptingEnvironment &scripting_environment, | ||
NodeBasedGraphFactory(ScriptingEnvironment &scripting_environment, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Above comment will need updating. |
||
std::vector<TurnRestriction> &turn_restrictions, | ||
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 &GetBarriers() const { return barriers; } | ||
|
@@ -60,9 +64,8 @@ class NodeBasedGraphFactory | |
void ReleaseOsmNodes(); | ||
|
||
private: | ||
// Get the information from the *.osrm file (direct product of the extractor callback/extraction | ||
// containers) and prepare the graph creation process | ||
void LoadDataFromFile(const boost::filesystem::path &input_file); | ||
// Build and validate compressed output graph | ||
void BuildCompressedOutputGraph(const std::vector<NodeBasedEdge> &edge_list); | ||
|
||
// 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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added kind of smoke test for
osrm-components
.