aws_sdk_location/client/calculate_route.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3 /// Constructs a fluent builder for the [`CalculateRoute`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder) operation.
4 ///
5 /// - The fluent builder is configurable:
6 /// - [`calculator_name(impl Into<String>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::calculator_name) / [`set_calculator_name(Option<String>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_calculator_name):<br>required: **true**<br><p>The name of the route calculator resource that you want to use to calculate the route.</p><br>
7 /// - [`departure_position(f64)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::departure_position) / [`set_departure_position(Option<Vec::<f64>>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_departure_position):<br>required: **true**<br><p>The start position for the route. Defined in <a href="https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84">World Geodetic System (WGS 84)</a> format: <code>\[longitude, latitude\]</code>.</p> <ul> <li> <p>For example, <code>\[-123.115, 49.285\]</code></p></li> </ul><note> <p>If you specify a departure that's not located on a road, Amazon Location <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">moves the position to the nearest road</a>. If Esri is the provider for your route calculator, specifying a route that is longer than 400 km returns a <code>400 RoutesValidationException</code> error.</p> </note> <p>Valid Values: <code>\[-180 to 180,-90 to 90\]</code></p><br>
8 /// - [`destination_position(f64)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::destination_position) / [`set_destination_position(Option<Vec::<f64>>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_destination_position):<br>required: **true**<br><p>The finish position for the route. Defined in <a href="https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84">World Geodetic System (WGS 84)</a> format: <code>\[longitude, latitude\]</code>.</p> <ul> <li> <p>For example, <code>\[-122.339, 47.615\]</code></p></li> </ul><note> <p>If you specify a destination that's not located on a road, Amazon Location <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">moves the position to the nearest road</a>.</p> </note> <p>Valid Values: <code>\[-180 to 180,-90 to 90\]</code></p><br>
9 /// - [`waypoint_positions(Vec::<f64>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::waypoint_positions) / [`set_waypoint_positions(Option<Vec::<Vec::<f64>>>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_waypoint_positions):<br>required: **false**<br><p>Specifies an ordered list of up to 23 intermediate positions to include along a route between the departure position and destination position.</p> <ul> <li> <p>For example, from the <code>DeparturePosition</code> <code>\[-123.115, 49.285\]</code>, the route follows the order that the waypoint positions are given <code>\[\[-122.757, 49.0021\],\[-122.349, 47.620\]\]</code></p></li> </ul><note> <p>If you specify a waypoint position that's not located on a road, Amazon Location <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">moves the position to the nearest road</a>.</p> <p>Specifying more than 23 waypoints returns a <code>400 ValidationException</code> error.</p> <p>If Esri is the provider for your route calculator, specifying a route that is longer than 400 km returns a <code>400 RoutesValidationException</code> error.</p> </note> <p>Valid Values: <code>\[-180 to 180,-90 to 90\]</code></p><br>
10 /// - [`travel_mode(TravelMode)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::travel_mode) / [`set_travel_mode(Option<TravelMode>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_travel_mode):<br>required: **false**<br><p>Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility. You can choose <code>Car</code>, <code>Truck</code>, <code>Walking</code>, <code>Bicycle</code> or <code>Motorcycle</code> as options for the <code>TravelMode</code>.</p><note> <p><code>Bicycle</code> and <code>Motorcycle</code> are only valid when using Grab as a data provider, and only within Southeast Asia.</p> <p><code>Truck</code> is not available for Grab.</p> <p>For more details on the using Grab for routing, including areas of coverage, see <a href="https://docs.aws.amazon.com/location/previous/developerguide/grab.html">GrabMaps</a> in the <i>Amazon Location Service Developer Guide</i>.</p> </note> <p>The <code>TravelMode</code> you specify also determines how you specify route preferences:</p> <ul> <li> <p>If traveling by <code>Car</code> use the <code>CarModeOptions</code> parameter.</p></li> <li> <p>If traveling by <code>Truck</code> use the <code>TruckModeOptions</code> parameter.</p></li> </ul> <p>Default Value: <code>Car</code></p><br>
11 /// - [`departure_time(DateTime)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::departure_time) / [`set_departure_time(Option<DateTime>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_departure_time):<br>required: **false**<br><p>Specifies the desired time of departure. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p> <ul> <li> <p>In <a href="https://www.iso.org/iso-8601-date-and-time-format.html">ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example, <code>2020–07-2T12:15:20.000Z+01:00</code></p></li> </ul><br>
12 /// - [`depart_now(bool)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::depart_now) / [`set_depart_now(Option<bool>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_depart_now):<br>required: **false**<br><p>Sets the time of departure as the current time. Uses the current time to calculate a route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p> <p>Default Value: <code>false</code></p> <p>Valid Values: <code>false</code> | <code>true</code></p><br>
13 /// - [`distance_unit(DistanceUnit)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::distance_unit) / [`set_distance_unit(Option<DistanceUnit>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_distance_unit):<br>required: **false**<br><p>Set the unit system to specify the distance.</p> <p>Default Value: <code>Kilometers</code></p><br>
14 /// - [`include_leg_geometry(bool)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::include_leg_geometry) / [`set_include_leg_geometry(Option<bool>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_include_leg_geometry):<br>required: **false**<br><p>Set to include the geometry details in the result for each path between a pair of positions.</p> <p>Default Value: <code>false</code></p> <p>Valid Values: <code>false</code> | <code>true</code></p><br>
15 /// - [`car_mode_options(CalculateRouteCarModeOptions)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::car_mode_options) / [`set_car_mode_options(Option<CalculateRouteCarModeOptions>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_car_mode_options):<br>required: **false**<br><p>Specifies route preferences when traveling by <code>Car</code>, such as avoiding routes that use ferries or tolls.</p> <p>Requirements: <code>TravelMode</code> must be specified as <code>Car</code>.</p><br>
16 /// - [`truck_mode_options(CalculateRouteTruckModeOptions)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::truck_mode_options) / [`set_truck_mode_options(Option<CalculateRouteTruckModeOptions>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_truck_mode_options):<br>required: **false**<br><p>Specifies route preferences when traveling by <code>Truck</code>, such as avoiding routes that use ferries or tolls, and truck specifications to consider when choosing an optimal road.</p> <p>Requirements: <code>TravelMode</code> must be specified as <code>Truck</code>.</p><br>
17 /// - [`arrival_time(DateTime)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::arrival_time) / [`set_arrival_time(Option<DateTime>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_arrival_time):<br>required: **false**<br><p>Specifies the desired time of arrival. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p><note> <p>ArrivalTime is not supported Esri.</p> </note><br>
18 /// - [`optimize_for(OptimizationMode)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::optimize_for) / [`set_optimize_for(Option<OptimizationMode>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_optimize_for):<br>required: **false**<br><p>Specifies the distance to optimize for when calculating a route.</p><br>
19 /// - [`key(impl Into<String>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::key) / [`set_key(Option<String>)`](crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::set_key):<br>required: **false**<br><p>The optional <a href="https://docs.aws.amazon.com/location/previous/developerguide/using-apikeys.html">API key</a> to authorize the request.</p><br>
20 /// - On success, responds with [`CalculateRouteOutput`](crate::operation::calculate_route::CalculateRouteOutput) with field(s):
21 /// - [`legs(Vec::<Leg>)`](crate::operation::calculate_route::CalculateRouteOutput::legs): <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request.</p> <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p> <ul> <li> <p>The <code>StartPosition</code> is the departure position.</p></li> <li> <p>The <code>EndPosition</code> is the destination position.</p></li> </ul> <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p> <ul> <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p></li> <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p></li> </ul>
22 /// - [`summary(Option<CalculateRouteSummary>)`](crate::operation::calculate_route::CalculateRouteOutput::summary): <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
23 /// - On failure, responds with [`SdkError<CalculateRouteError>`](crate::operation::calculate_route::CalculateRouteError)
24 pub fn calculate_route(&self) -> crate::operation::calculate_route::builders::CalculateRouteFluentBuilder {
25 crate::operation::calculate_route::builders::CalculateRouteFluentBuilder::new(self.handle.clone())
26 }
27}