From e3adb4702ff7ff44a9419e039e9a9c950d3379f5 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sat, 27 Mar 2021 11:45:55 -0700 Subject: [PATCH] Handle some changes to the elevation_lookups importing. #82 --- convert_osm/src/elevation.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/convert_osm/src/elevation.rs b/convert_osm/src/elevation.rs index 9a87a335c1..c02e6ac834 100644 --- a/convert_osm/src/elevation.rs +++ b/convert_osm/src/elevation.rs @@ -43,10 +43,13 @@ pub fn add_data(map: &mut RawMap, timer: &mut Timer) -> Result<()> { )) .arg("-t") // TODO Upload this to Docker Hub, so it's easier to distribute - .arg("elevation_lookups_lidar") + .arg("elevation_lookups_srtm") .arg("python3") .arg("main.py") - .arg("query"), + .arg("query") + // TODO How to tune this? Pretty machine dependant, and using ALL available cores may + // melt memory. + .arg("--n_threads=1"), ); timer.stop("run elevation_lookups"); @@ -108,12 +111,20 @@ fn scrape_output(map: &mut RawMap, ids: Vec) -> Result<()> { let line = line?; let mut values = Vec::new(); for x in line.split('\t') { - let x = x.parse::()?; - if !x.is_finite() { - // TODO Warn + if let Ok(x) = x.parse::() { + if !x.is_finite() { + // TODO Warn + continue; + } + if x < 0.0 { + // TODO Temporary + continue; + } + values.push(Distance::meters(x)); + } else { + // Blank lines mean the tool failed to figure out what happened continue; } - values.push(Distance::meters(x)); } if values.len() != 4 { error!("Elevation output line \"{}\" doesn't have 4 numbers", line);