Remove the old SRTM code, which has always been broken. Remove the elevation from importer config; the new approach will detect the right data source to use automatically using the bbox. #82

This commit is contained in:
Dustin Carlino 2021-03-18 10:14:43 -07:00
parent a390f72a1c
commit ffc4f4222d
65 changed files with 0 additions and 139 deletions

1
Cargo.lock generated
View File

@ -598,7 +598,6 @@ dependencies = [
"abstio",
"abstutil",
"anyhow",
"byteorder",
"geojson",
"geom",
"kml",

View File

@ -8,7 +8,6 @@ edition = "2018"
abstio = { path = "../abstio" }
abstutil = { path = "../abstutil" }
anyhow = "1.0.38"
byteorder = "1.4.2"
geojson = "0.22"
geom = { path = "../geom" }
kml = { path = "../kml" }

View File

@ -19,7 +19,6 @@ mod parking;
pub mod reader;
mod snappy;
mod split_ways;
mod srtm;
mod transit;
pub struct Options {
@ -33,9 +32,6 @@ pub struct Options {
pub onstreet_parking: OnstreetParking,
pub public_offstreet_parking: PublicOffstreetParking,
pub private_offstreet_parking: PrivateOffstreetParking,
/// If provided, pull elevation data from this SRTM file. The SRTM parser is incorrect, so the
/// results will be nonsense.
pub elevation: Option<String>,
/// OSM railway=rail will be included as light rail if so. Cosmetic only.
pub include_railroads: bool,
/// If provided, read polygons from this GeoJSON file and add them to the RawMap as buildings.
@ -113,9 +109,6 @@ pub fn convert(opts: Options, timer: &mut abstutil::Timer) -> RawMap {
parking::apply_parking(&mut map, &opts, timer);
if let Some(ref path) = opts.elevation {
use_elevation(&mut map, path, timer);
}
if false {
generate_elevation_queries(&map).unwrap();
}
@ -147,20 +140,6 @@ fn use_amenities(map: &mut RawMap, amenities: Vec<(Pt2D, Amenity)>, timer: &mut
}
}
fn use_elevation(map: &mut RawMap, path: &str, timer: &mut Timer) {
timer.start("apply elevation data to intersections");
let elevation = srtm::Elevation::load(path).unwrap();
for i in map.intersections.values_mut() {
// TODO Not sure why, but I've seen nodes from South Carolina wind up in the updated
// Seattle extract. And I think there's a bug with clipping, because they survive to this
// point. O_O
if map.boundary_polygon.contains_pt(i.point) {
i.elevation = elevation.get(i.point.to_gps(&map.gps_bounds));
}
}
timer.stop("apply elevation data to intersections");
}
fn generate_elevation_queries(map: &RawMap) -> Result<()> {
use std::fs::File;
use std::io::Write;

View File

@ -1,52 +0,0 @@
use std::fs::File;
use anyhow::Result;
use byteorder::{BigEndian, ReadBytesExt};
use geom::{Distance, LonLat};
// TODO Make sure this actually works, and link to references describing the format.
// - It's VERY wrong! Look at 19th and Boyer, and Delmar.
// TODO Use http://gis.ess.washington.edu/data/raster/tenmeter/byquad/seattle/index.html or
// something else instead?
// Assuming the 3-second arcs
const GRID_DIM: usize = 1201;
pub struct Elevation {
lon_offset: f64,
lat_offset: f64,
data: Vec<i16>,
}
impl Elevation {
pub fn load(path: &str) -> Result<Elevation> {
println!("Reading elevation data from {}", path);
let mut f = File::open(path)?;
let mut e = Elevation {
// TODO dont hardcode
lon_offset: -122.0,
lat_offset: 47.0,
data: Vec::with_capacity(GRID_DIM.pow(2)),
};
// TODO off by one?
for _ in 0..GRID_DIM.pow(2) {
e.data.push(f.read_i16::<BigEndian>()?);
}
Ok(e)
}
pub fn get(&self, pt: LonLat) -> Distance {
// TODO assert the (lon, lat) match the offsets
// TODO not tons of confidence in any of this.
// TODO interpolate from the 4 matching tiles?
let x = ((pt.x() - self.lon_offset).abs() * (GRID_DIM as f64)) as usize;
let y = ((pt.y() - self.lat_offset).abs() * (GRID_DIM as f64)) as usize;
let i = x + (y * GRID_DIM);
if i >= self.data.len() {
panic!("srtm lookup for out-of-bounds {}", pt);
}
Distance::meters(f64::from(self.data[i]))
}
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -15,7 +15,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/allerton_bywater/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/ashton_park/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/aylesbury/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/aylesham/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/bailrigg/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/bath_riverside/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/bicester/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/castlemead/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/chapelford/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/clackers_brook/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/culm/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/didcot/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/dunton_hills/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/ebbsfleet/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/halsnead/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/hampton/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/handforth/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/kidbrooke_village/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/micklefield/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/newcastle_great_park/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/poundbury/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/priors_hall/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/tresham/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/tyersal_lane/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/upton/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/wichelstowe/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/wixams/procgen_houses.json"
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": "data/input/gb/wynyard/procgen_houses.json"
}

View File

@ -15,7 +15,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -15,7 +15,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -15,7 +15,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 3
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -11,7 +11,6 @@
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"elevation": null,
"include_railroads": true,
"extra_buildings": null
}

View File

@ -25,9 +25,6 @@ pub struct GenericCityImporter {
pub onstreet_parking: convert_osm::OnstreetParking,
pub public_offstreet_parking: convert_osm::PublicOffstreetParking,
pub private_offstreet_parking: convert_osm::PrivateOffstreetParking,
/// If provided, pull elevation data from this SRTM file. The SRTM parser is incorrect, so the
/// results will be nonsense.
pub elevation: Option<String>,
/// OSM railway=rail will be included as light rail if so. Cosmetic only.
pub include_railroads: bool,
/// If provided, read polygons from this GeoJSON file and add them to the RawMap as buildings.
@ -80,7 +77,6 @@ impl GenericCityImporter {
onstreet_parking: self.onstreet_parking.clone(),
public_offstreet_parking: self.public_offstreet_parking.clone(),
private_offstreet_parking: self.private_offstreet_parking.clone(),
elevation: self.elevation.clone(),
include_railroads: self.include_railroads,
extra_buildings: self.extra_buildings.clone(),
},

View File

@ -338,7 +338,6 @@ fn oneshot(
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(1),
elevation: None,
include_railroads: true,
extra_buildings: None,
},

View File

@ -143,7 +143,6 @@ pub async fn osm_to_raw(name: &str, timer: &mut Timer<'_>, config: &ImporterConf
_ => 1,
},
),
elevation: None,
// They mess up 16th and E Marginal badly enough to cause gridlock.
include_railroads: false,
extra_buildings: None,

View File

@ -65,7 +65,6 @@ impl Model {
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(
0,
),
elevation: None,
include_railroads: true,
extra_buildings: None,
},

View File

@ -32,7 +32,6 @@ A/B Street binary releases contain pre-built maps that combine data from:
(<https://creativecommons.org/publicdomain/zero/1.0/>)
- Puget Sound Regional Council
(<https://www.psrc.org/activity-based-travel-model-soundcast>)
- USGS SRTM
Other binary data bundled in:

View File

@ -61,7 +61,6 @@ fn import_map(path: String) -> Map {
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(0),
elevation: None,
include_railroads: true,
extra_buildings: None,
},