MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / ParseOSMData

Method ParseOSMData

src/extractor/extractor.cpp:351–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351Extractor::ParsedOSMData Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
352 const unsigned number_of_threads)
353{
354 TIMER_START(extracting);
355
356 util::Log() << "Input file: " << config.input_path.filename().string();
357 if (!config.profile_path.empty())
358 {
359 util::Log() << "Profile: " << config.profile_path.filename().string();
360 }
361 util::Log() << "Threads: " << number_of_threads;
362
363 const osmium::io::File input_file(config.input_path.string());
364 osmium::thread::Pool pool(number_of_threads);
365
366 util::Log() << "Parsing in progress..";
367 TIMER_START(parsing);
368
369 { // Parse OSM header
370 osmium::io::Reader reader(input_file, pool, osmium::osm_entity_bits::nothing);
371 osmium::io::Header header = reader.header();
372
373 std::string generator = header.get("generator");
374 if (generator.empty())
375 {
376 generator = "unknown tool";
377 }
378 util::Log() << "input file generated by " << generator;
379
380 // write .timestamp data file
381 std::string timestamp = header.get("osmosis_replication_timestamp");
382 if (config.data_version == "osmosis")
383 {
384 files::writeTimestamp(config.GetPath(".osrm.timestamp").string(), timestamp);
385 }
386 else
387 {
388 files::writeTimestamp(config.GetPath(".osrm.timestamp").string(), config.data_version);
389 }
390 if (timestamp.empty())
391 {
392 timestamp = "n/a";
393 }
394 util::Log() << "timestamp: " << timestamp;
395 }
396
397 // Extraction containers and restriction parser
398 ExtractionContainers extraction_containers;
399 ExtractorCallbacks::ClassesMap classes_map;
400 LaneDescriptionMap turn_lane_map;
401 auto extractor_callbacks =
402 std::make_unique<ExtractorCallbacks>(extraction_containers,
403 classes_map,
404 turn_lane_map,
405 scripting_environment.GetProfileProperties());
406
407 // get list of supported relation types
408 auto relation_types = scripting_environment.GetRelations();

Callers

nothing calls this directly

Calls 15

LogClass · 0.85
writeTimestampFunction · 0.85
exceptionClass · 0.85
SetClassNamesFunction · 0.85
SetExcludableClassesFunction · 0.85
writeProfilePropertiesFunction · 0.85
checkPackedOSMNodeIdFitsFunction · 0.85
GetPathMethod · 0.80
ProcessRestrictionMethod · 0.80
typeMethod · 0.80
refMethod · 0.80

Tested by

no test coverage detected