abstreet/importer/src/xian.rs
Dustin Carlino 67530bec07 Future-proof file organization by changing map_name from a string to a
struct. Whatever choices we make next about naming cities hierarchially
or not can be managed in just one place. #326

This is a pretty huge change, but the compiler gives reasonable
confidence it's correct. More bugs are likely to crop up in the next
step, when filenames start being namespaced by the city too.
2020-11-04 17:26:32 -08:00

45 lines
1.4 KiB
Rust

use abstutil::MapName;
use crate::configuration::ImporterConfiguration;
use crate::utils::{download, osmconvert};
fn input(config: &ImporterConfiguration) {
download(
config,
"input/xian/osm/china-latest.osm.pbf",
"http://download.geofabrik.de/asia/china-latest.osm.pbf",
);
}
pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConfiguration) {
input(config);
osmconvert(
"input/xian/osm/china-latest.osm.pbf",
format!("input/xian/polygons/{}.poly", name),
format!("input/xian/osm/{}.osm", name),
config,
);
let map = convert_osm::convert(
convert_osm::Options {
osm_input: abstutil::path(format!("input/xian/osm/{}.osm", name)),
name: MapName::new("xian", name),
clip: Some(abstutil::path(format!("input/xian/polygons/{}.poly", name))),
map_config: map_model::MapConfig {
driving_side: map_model::DrivingSide::Right,
bikes_can_use_bus_lanes: true,
inferred_sidewalks: true,
},
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(3),
elevation: None,
include_railroads: true,
},
timer,
);
map.save();
}