vehicle_generation_tool
Generate vehicles for SUMO simulation by specifying source and destination locations, with optimal path calculation and support for road names or geocoding.
Instructions
Add vehicles from source to destination with optimal path calculation.
SUPPORTS TWO MODES:
1. Road Name Mode:
- Use exact road names (e.g., '테헤란로', '강남대로')
- Set use_geocoding=False (default)
2. Location Mode (Recommended):
- Use any location name or place (e.g., '강남역', '코엑스', 'Gangnam Station, Seoul')
- Uses geocoding to find coordinates, then finds nearest edges
- Set use_geocoding=True
- Automatically validates if location is within network bounds
IMPORTANT NOTES:
- Location Mode validates coordinates against network bounds (1km buffer)
- If location is outside network, you'll get a clear error with network bbox info
- Search radius is 300m by default (sufficient for most cases)
Args:
route_file: Route file path
net_file: Network file path
source_location: Source location (road name OR place name)
destination_location: Destination location (road name OR place name)
vehicle_id: Vehicle ID prefix (default: "genveh_0")
depart_time: Departure time in seconds (default: 0.0)
depart_time_range: Departure time range [min, max] in seconds (optional)
vehicle_count: Number of vehicles to generate (default: 1)
output_dir: Output directory for results
use_geocoding: If True, use location-based mode with geocoding (default: False)
search_radius: Search radius in km for nearest edge (default: 0.3 = 300m)
Examples:
Road name mode:
vehicle_generation_tool(
route_file="routes.rou.xml",
net_file="gangnam.net.xml",
source_location="테헤란로",
destination_location="강남대로",
use_geocoding=False
)
Location mode (RECOMMENDED):
vehicle_generation_tool(
route_file="routes.rou.xml",
net_file="gangnam.net.xml",
source_location="강남역",
destination_location="코엑스",
use_geocoding=True,
vehicle_count=20
)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| net_file | Yes | ||
| output_dir | No | output/trips | |
| route_file | Yes | ||
| vehicle_id | No | genveh_0 | |
| depart_time | No | ||
| search_radius | No | ||
| use_geocoding | No | ||
| vehicle_count | No | ||
| source_location | Yes | ||
| depart_time_range | No | ||
| destination_location | Yes |