Change the procgen house tool to also handle taking in a .osm file and doing the quick one-shot conversion. This'll simplify the actdev site import process.
@@ -16,10 +16,19 @@ use map_model::{osm, Map};
fn main() {
let mut timer = Timer::new("generate houses");
let mut args = CmdArgs::new();
- let map = Map::load_synchronously(args.required("--map"), &mut timer);
let num_required = args.required("--num_required").parse::<usize>().unwrap();
let out = args.required("--out");
let mut rng = XorShiftRng::seed_from_u64(args.required("--rng_seed").parse::<u64>().unwrap());
+ let map = if let Some(path) = args.optional("--map") {
+ Map::load_synchronously(path, &mut timer)
+ } else {
+ import_map(
+ args.required("--osm"),
+ args.optional("--clip"),
+ !args.enabled("--drive_on_left"),
+ &mut timer,
+ )
+ };
args.done();
let houses = generate_buildings_on_empty_residential_roads(&map, &mut rng, &mut timer);
@@ -163,3 +172,39 @@ fn rand_dist(rng: &mut XorShiftRng, low: f64, high: f64) -> Distance {
assert!(high > low);
Distance::meters(rng.gen_range(low..high))
}
+
+fn import_map(
+ osm_input: String,
+ clip: Option<String>,
+ drive_on_right: bool,
+ timer: &mut Timer,
+) -> Map {
+ let raw = convert_osm::convert(
+ convert_osm::Options {
+ osm_input,
+ name: abstio::MapName::new("zz", "oneshot", "procgen"),
+
+ clip,
+ map_config: map_model::MapConfig {
+ driving_side: if drive_on_right {
+ map_model::DrivingSide::Right
+ } else {
+ map_model::DrivingSide::Left
+ },
+ bikes_can_use_bus_lanes: true,
+ inferred_sidewalks: true,
+ street_parking_spot_length: Distance::meters(8.0),
+ },
+
+ onstreet_parking: convert_osm::OnstreetParking::JustOSM,
+ public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
+ private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(1),
+ include_railroads: true,
+ extra_buildings: None,
+ },
+ timer,
+ );
+ let build_ch = false;
+ let keep_bldg_tags = false;
+ map_model::Map::create_from_raw(raw, build_ch, keep_bldg_tags, timer)
+}
