CLI Reference#
This page provides documentation for our command line tools.
genet#
GeNet Command Line Tool.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--version |
boolean | Show the version and exit. | False |
--help |
boolean | Show this message and exit. | False |
genet add-elevation-to-network#
Add elevation data to network nodes, validate it, and calculate link slopes.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-el , --elevation |
path | Path to the elevation tif file | _required |
-nv , --null_value |
float | Value that represents null in the elevation tif file | 0.0 |
-nwe , --no-write_elevation_to_network |
boolean | Do not write node elevation data as attribute to the network | True |
-nwsn , --no-write_slope_to_network |
boolean | Do not write link slope data as attribute to the network | True |
-nwsoa , --no-write_slope_to_object_attribute_file |
boolean | Do not write link slope data to object attribute file | True |
-nsj , --no-save_jsons |
boolean | Do not save elevation and slope dictionaries and report | True |
--help |
boolean | Show this message and exit. | False |
genet auto-schedule-fixes#
Script to check and correct, if needed, the speed and headway of services in the schedule.
Checks and corrects for: - zero headways - we check that there are no 0 minute headways. that would mean two of the same trips start at the same time. To correct this we delete one of the trips, treating it as a duplicate. - infinite speeds - We calculate speed between each stop pair for services. We use the declared times at stops and crow-fly distance * 1.3 network factor. This is done also for routed modes like bus to simplify things, as we are only after infinite speeds which will show up whether we use the true route or not. Infinite speeds exist as a consequence of division by zero (time). This is corrected by recalculating the arrival and departure times at the problem stops; the times at other stops are kept the same as much as possible.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | _required |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-vsc , --vehicle_scalings |
text | Comma delimited list of scales for vehicles | 1,10 |
-od , --output_dir |
directory | Output directory | _required |
--help |
boolean | Show this message and exit. | False |
genet generate-standard-outputs#
Generate Standard outputs for a network and/or schedule
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
--help |
boolean | Show this message and exit. | False |
genet inspect-google-directions-requests-for-network#
Generate Google Directions API requests for a network for inspection
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-sc , --subset_conditions |
text | Comma delimited list of values to subset the network by using attributes-osm:way:highway network attributes, e.g., primary,motorway } |
None |
--help |
boolean | Show this message and exit. | False |
genet intermodal-access-egress-network#
Process to add access and egress links for PT stops of given modes.
Intended to generate PT schedules to work with SBB extensions in MATSim: https://github.com/matsim-org/matsim-libs/tree/master/contribs/sbb-extensions#intermodal-access-and-egress
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-pm , --pt_modes |
text | Comma delimited list of modes to subset stops of interest. A stop is linked to a mode via a transit route using that stop. Optional, otherwise considers all stops | None |
-nm , --network_snap_modes |
text | Comma delimited list of modes to subset the network graph. The links from this modal subgraph will be considered for the stop to graph relationship. Two new attributes (per mode) will be added to PT stops:xmodeAccessible = true and accessLinkId_xmode = link_id | car |
-tm , --teleport_modes |
text | Comma delimited list of (teleported) modes to enable for given PT stops No links will be found for these modes. One new attributes (per mode) will be added to PT stops: xmodeAccessible = true | None |
-ss , --step_size |
float | In metres. This process finds links in the nearest neighbourhood of a stop. The size of the neighbourhood increases by step_size value each time until it finds links to relate to stops. |
25 |
-dt , --distance_threshold |
float | In metres. This is the limit of how wide the search area for a link can be for each stop. | None |
--help |
boolean | Show this message and exit. | False |
genet make-pt-network#
Create a PT MATSim network
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-oc , --osm_config |
file | Location of the config file defining what and how to read from the osm file | None |
-o , --osm |
file | Location of the osm file | None |
-gd , --gtfs_day |
text | gtfs day to use in the format YYYYMMDD |
_required |
-g , --gtfs |
path | Location of the gtfs zip file of folder with gtfs text files | _required |
-pp , --processes |
integer | Number of parallel processes to split process across | 1 |
-sd , --snapping_distance |
float | Distance for snapping network nodes to transit stops | 30 |
--help |
boolean | Show this message and exit. | False |
genet make-road-only-network#
Create a road-only MATSim network
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-oc , --osm_config |
file | Location of the config file defining what and how to read from the osm file | _required |
-o , --osm |
file | Location of the osm file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-pp , --processes |
integer | Number of parallel processes to split process across | 1 |
-od , --output_dir |
directory | Output directory | _required |
-cc , --connected_components |
integer | Number of connected components within graph for modes walk ,bike ,car |
1 |
--help |
boolean | Show this message and exit. | False |
genet reproject-network#
Reproject a MATSim network
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-pp , --processes |
integer | Number of parallel processes to split process across | 1 |
-od , --output_dir |
directory | Output directory | _required |
-cp , --current_projection |
text | The projection network is currently in, eg. "epsg:27700" | _required |
-np , --new_projection |
text | The projection desired, eg. "epsg:27700" | _required |
--help |
boolean | Show this message and exit. | False |
genet scale-vehicles#
Scale PT Schedule vehicles
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-vsc , --vehicle_scalings |
text | Comma delimited list of scales for vehicles | 1,10 |
-od , --output_dir |
directory | Output directory | _required |
--help |
boolean | Show this message and exit. | False |
genet send-google-directions-requests-for-network#
Generate and send Google Directions API requests
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-sc , --subset_conditions |
text | Comma delimited list of values to subset the network by using attributes-osm:way:highway network attributes, e.g., primary,motorway } |
None |
-od , --output_dir |
directory | Output directory | _required |
-t , --requests_threshold |
integer | Max number of API requests you are happy to send. If exceeded, will fail without sending any | _required |
-k , --api_key |
text | Google Directions API key if not using AWS secrets manager | None |
-sn , --secret_name |
text | Secret name in AWS Secrets manager, if not passing the API key directly | None |
-rn , --region_name |
text | Region name in AWS, if not passing the API key directly | None |
-tm , --traffic_model |
text | Google Directions API traffic model to consider when calculating time in traffic for choices. See https://developers.google.com/maps/documentation/directions/get-directions#traffic_model | best_guess |
-dp , --departure_time |
text | desired time of departure, in unix time, or now for current traffic conditions |
now |
--help |
boolean | Show this message and exit. | False |
genet separate-modes-in-network#
Generate new links, each for the use of a singular mode in a MATSim network.
This creates separate modal subgraphs for the given modes. It can be used with MATSim to ensure the two modes do not come in contact.
Examples:
```python
[1] network.link("LINK_ID")
[out] {"id": "LINK_ID", "modes": {"car", "bike"}, "freespeed": 5, ...}
```
The new bike link will assume all the same attributes apart from the "modes":
```python
[1] network.link("bike---LINK_ID")`
[out] {"id": "bike---LINK_ID", "modes": {"bike"}, "freespeed": 5, ...}
```
In the case when a link already has a single dedicated mode, it will be replaced aby a link with a new, prefixed ID.
Other links modes will have changed also.
So, any simulation outputs may not be valid with this new network.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-m , --modes |
text | Comma delimited list of modes to split from the network | _required |
-ic , --increase_capacity |
boolean | Sets capacity on detached links to 9999 | False |
--help |
boolean | Show this message and exit. | False |
genet simplify-network#
Simplify a MATSim network by removing intermediate links from paths
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-pp , --processes |
integer | Number of parallel processes to split process across | 1 |
-vsc , --vehicle_scalings |
text | Comma delimited list of scales for vehicles | 1,10 |
-od , --output_dir |
directory | Output directory | _required |
-fc , --force_strongly_connected_graph |
boolean | If True, checks for disconnected subgraphs for modes walk , bike and car . If there are more than one strongly connected subgraph, genet connects them with links at closest points in the graph. The links used to connect are weighted at 20% of surrounding freespeed and capacity values. |
False |
--help |
boolean | Show this message and exit. | False |
genet squeeze-external-area#
Changes freespeed
and capacity
values for links outside of the given study_area
by given factors.
To squeeze links within the study area, refer to the squeeze_urban_links
command.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-c , --capacity |
float | Factor, e.g. 0.5, to reduce the 'capacity' attribute for the roads being squeezed. The current value will be multiplied by this factor. | 1 |
-f , --freespeed |
float | Factor, e.g. 0.5, to reduce the 'freespeed' attribute for the roads being squeezed. The current value will be multiplied by this factor. | 1 |
-sa , --study_area |
path | Geojson or shp file that when read into geopandas produces a table with a geometry column that describes the area which should be left unaffected by speed and capacity factors. | None |
--help |
boolean | Show this message and exit. | False |
genet squeeze-urban-links#
Tag minor network links as urban, given geometries: urban_geometries
.
Minor links are defined as anything other than: osm way highway tags: motorway, motorway_link, trunk, trunk_link, primary, primary_link.
Urban geometries are passed via geojson input with a specific format, see command arguments for description.
Passing study_area
subsets the urban geometries and links to be squeezed - only links in the study area will be tagged and squeezed.
This is useful if your geometries covers a larger area.
The script then reduces capacity and/or freespeed by a factor of current value on those links.
To squeeze links outside the study area, refer to the squeeze_external_area.py
command.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
-ug , --urban_geometries |
path | Geojson or shp file that when read into geopandas produces a table with columns: "label" (with at least some of the values in this column being a string: "urban") and "geometry" (polygons defining urban areas) | _required |
-c , --capacity |
float | Factor, e.g. 0.5, to reduce the 'capacity' attribute for the roads being squeezed. The current value will be multiplied by this factor. | 1 |
-f , --freespeed |
float | Factor, e.g. 0.5, to reduce the 'freespeed' attribute for the roads being squeezed. The current value will be multiplied by this factor. | 1 |
-sa , --study_area |
path | Geojson or shp file that when read into geopandas produces a table with a geometry column that describes the area which should be left unaffected by speed and capacity factors. | None |
--help |
boolean | Show this message and exit. | False |
genet validate-network#
Run MATSim specific validation methods on a MATSim network
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-n , --network |
path | Location of the input network.xml file | _required |
-s , --schedule |
path | Location of the input schedule.xml file | None |
-v , --vehicles |
path | Location of the input vehicles.xml file | None |
-p , --projection |
text | The projection network is in, eg. "epsg:27700" | _required |
-od , --output_dir |
directory | Output directory | _required |
--help |
boolean | Show this message and exit. | False |