pub(crate) enum Command {
Show 17 variants
DumpJSON {
path: String,
},
RandomScenario {
rng_seed: u64,
map: String,
scenario_name: String,
},
AugmentScenario {
input_scenario: String,
add_return_trips: bool,
add_lunch_trips: bool,
scenario_modifiers: Vec<ScenarioModifier>,
delete_cancelled_trips: bool,
rng_seed: u64,
},
ClipOSM {
pbf_path: String,
clip_path: String,
out_path: String,
},
GeoJSONToOsmosis {
input: String,
},
ImportGrid2Demand {
input: String,
map: String,
},
ImportScenario {
input: String,
map: String,
skip_problems: bool,
},
ImportJSONMap {
input: String,
output: String,
},
MinifyMap {
map: String,
},
GenerateHouses {
map: String,
num_required: usize,
rng_seed: u64,
output: String,
},
PickGeofabrik {
input: String,
},
OneStepImport {
geojson_path: String,
map_name: String,
drive_on_left: bool,
use_geofabrik: bool,
filter_crosswalks: bool,
create_uk_travel_demand_model: bool,
},
OneshotImport {
osm_input: String,
clip_path: Option<String>,
drive_on_left: bool,
filter_crosswalks: bool,
create_uk_travel_demand_model: bool,
opts: RawToMapOptions,
},
RegenerateEverything {
shard_num: usize,
num_shards: usize,
},
RegenerateEverythingExternally,
Import {
job: Job,
},
PrebakeScenario {
scenario_path: String,
},
}
Variants
DumpJSON
Fields
path: String
Print a binary map or scenario file as JSON
RandomScenario
Fields
rng_seed: u64
A seed for generating random numbers
map: String
The path to a map to generate a scenario for
scenario_name: String
The name of the scenario to generate
Generates a random scenario using the proletariat robot travel demand model
AugmentScenario
Fields
input_scenario: String
The path to a scenario to augment. This will be modified in-place.
This tool isn’t very smart about detecting if a scenario already has these extra trips added in; be careful about running this on the correct input.
add_return_trips: bool
For people with only a single trip, add a return trip back home sometime 4-12 hours later
add_lunch_trips: bool
Before a person’s final trip home, insert a round-trip to a nearby cafe or restaurant
scenario_modifiers: Vec<ScenarioModifier>
A JSON list of modifiers to transform the scenario. These can be generated with the GUI.
delete_cancelled_trips: bool
Delete cancelled trips, and delete people with no remaining trips.
rng_seed: u64
A seed for generating random numbers
Modifies the schedule of every person in an existing scenario.
ClipOSM
Fields
pbf_path: String
The path to the input .osm.pbf file
clip_path: String
The path to an Osmosis boundary polygon
out_path: String
The path to write the XML results
Clips an OSM file to a boundary. This is a simple Rust port of osmconvert large_map.osm -B=clipping.poly --complete-ways -o=smaller_map.osm
.
GeoJSONToOsmosis
Fields
input: String
The path to a GeoJSON file
Reads a GeoJSON file, extracts a polygon from every feature, and writes numbered files in the https://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format format as output.
ImportGrid2Demand
Fields
input: String
The path to a grid2demand CSV file
map: String
The path to a map matching the grid2demand data
Import a scenario from https://github.com/asu-trans-ai-lab/grid2demand.
ImportScenario
Fields
input: String
The path to a JSON scenario file
map: String
The path to a map matching the scenario data
skip_problems: bool
Problems occur when a position is within the map boundary, but not close enough to buildings. Skip people with problematic positions if true, abort otherwise.
Import a JSON scenario in the https://a-b-street.github.io/docs/tech/dev/formats/scenarios.html format
ImportJSONMap
Transform a JSON map that’s been manually edited into the binary format suitable for simulation.
MinifyMap
Fields
map: String
The path to a map to shrink. The map is modified in-place.
Removes nonessential parts of a Map, for the bike network tool.
GenerateHouses
Fields
map: String
The path to a map to generate houses for
num_required: usize
If the tool doesn’t generate at least this many houses, then fail. This can be used to autodetect if a map probably already has most houses tagged in OSM.
rng_seed: u64
A seed for generating random numbers
output: String
The GeoJSON file to write
Procedurally generates houses along empty residential roads of a map
PickGeofabrik
Fields
input: String
The path to an osmosis polygon boundary file
Prints the osm.pbf file from download.geofabrik.de that covers a given boundary.
This is a useful tool when importing a new map, if you don’t already know which geofabrik file you should use as your OSM input.
OneStepImport
Fields
geojson_path: String
The path to a GeoJSON file with a boundary
map_name: String
What to name the new imported map. The country will always be “zz” (a fake country code), with the city as “oneshot.” This name shouldn’t contain spaces or be empty.
drive_on_left: bool
Do people drive on the left side of the road in this map?
use_geofabrik: bool
Use Geofabrik to grab OSM input if true, or Overpass if false. Overpass is faster.
filter_crosswalks: bool
Downgrade crosswalks not matching a highway=crossing
OSM node into unmarked crossings.
create_uk_travel_demand_model: bool
Generate a simple travel demand model based on 2011 UK commuting data. This will only work if the boundary is in the UK.
Imports a one-shot A/B Street map from a GeoJSON boundary in a single command.
OneshotImport
Fields
osm_input: String
clip_path: Option<String>
The path to an Osmosis boundary polygon. If omitted, a boundary will be derived from the .osm file, but borders will likely be broken or missing.
drive_on_left: bool
Do people drive on the left side of the road in this map?
filter_crosswalks: bool
Downgrade crosswalks not matching a highway=crossing
OSM node into unmarked crossings.
create_uk_travel_demand_model: bool
Generate a simple travel demand model based on 2011 UK commuting data. This will only work if the boundary is in the UK.
opts: RawToMapOptions
Imports a one-shot A/B Street map from an .osm file in a single command.
RegenerateEverything
Fields
shard_num: usize
If this command is being run in the cloud, parallelize the jobs by specifying which shard this invocation should run.
num_shards: usize
If this command is being run in the cloud, parallelize the jobs by specifying how many total shards there are.
Regenerate all maps and scenarios from scratch.
RegenerateEverythingExternally
Generate a shell script to regenerate all cities that uses an external task runner.
Import
Fields
job: Job
Import RawMaps, maps, scenarios, and city overviews for a single city.
PrebakeScenario
Fields
scenario_path: String
The path to a scenario file
Simulate a full day of a scenario, and write the “prebaked results,” so the UI can later be used for A/B testing.
Trait Implementations
sourceimpl StructOpt for Command
impl StructOpt for Command
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Builds the struct from clap::ArgMatches
. It’s guaranteed to succeed
if matches
originates from an App
generated by [StructOpt::clap
] called on
the same type, otherwise it must panic. Read more
fn from_args() -> Self
fn from_args() -> Self
Builds the struct from the command line arguments (std::env::args_os
).
Calls clap::Error::exit
on failure, printing the error message and aborting the program. Read more
fn from_args_safe() -> Result<Self, Error>
fn from_args_safe() -> Result<Self, Error>
Builds the struct from the command line arguments (std::env::args_os
).
Unlike [StructOpt::from_args
], returns clap::Error
on failure instead of aborting the program,
so calling .exit
is up to you. Read more
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making.
Print the error message and quit the program in case of failure. Read more
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making. Read more
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more