Skip to main content

AutoCostingOptions

Struct AutoCostingOptions 

Source
pub struct AutoCostingOptions { /* private fields */ }
Expand description

Auto Costing Options

Implementations§

Source§

impl AutoCostingOptions

Source

pub fn builder() -> Self

Creates a new instance of AutoCostingOptions.

Source

pub fn gate_cost(self, gate_cost: f32) -> Self

A cost applied when a gate with undefined or private access is encountered.

This cost is added to the estimated time / elapsed time.

Default: 30 seconds

Source

pub fn gate_penalty(self, gate_penalty: f32) -> Self

A penalty applied when a gate with no access information is on the road.

Default: 300 seconds

Source

pub fn private_access_penalty(self, private_access_penalty: f32) -> Self

A penalty applied when a gate or bollard with access=private is encountered.

Default: 450 seconds

Source

pub fn destination_only_penalty(self, destination_only_penalty: f32) -> Self

A penalty applied when entering a road which is only allowed to enter if necessary to reach the destination.

Source

pub fn toll_booth_cost(self, toll_booth_cost: f32) -> Self

A cost applied when a toll booth is encountered.

This cost is added to the estimated and elapsed times.

Default: 15 seconds

Source

pub fn toll_booth_penalty(self, toll_booth_penalty: f32) -> Self

A penalty applied to the cost when a toll booth is encountered.

This penalty can be used to create paths that avoid toll roads.

Default: 0

Source

pub fn ferry_cost(self, ferry_cost: f32) -> Self

A cost applied when entering a ferry.

This cost is added to the estimated and elapsed times.

Default: 300 seconds (5 minutes)

Source

pub fn use_ferry(self, use_ferry: f32) -> Self

This value indicates the willingness to take ferries.

This is a range of values between 0 and 1:

  • Values near 0 attempt to avoid ferries and
  • values near 1 will favor ferries.

Note: sometimes ferries are required to complete a route so values of 0 are not guaranteed to avoid ferries entirely.

Default: 0.5

Source

pub fn use_highways(self, use_highways: f32) -> Self

This value indicates the willingness to take highways.

This is a range of values between 0 and 1:

  • Values near 0 attempt to avoid highways and
  • values near 1 will favor highways.

Note: sometimes highways are required to complete a route so values of 0 are not guaranteed to avoid highways entirely.

Default: 1.0

Source

pub fn use_tolls(self, use_tolls: f32) -> Self

This value indicates the willingness to take roads with tolls.

This is a range of values between 0 and 1:

  • Values near 0 attempt to avoid tolls and
  • values near 1 will not attempt to avoid them.

Note: sometimes roads with tolls are required to complete a route so values of 0 are not guaranteed to avoid them entirely.

Default: 0.5

Source

pub fn use_living_streets(self, use_living_streets: f32) -> Self

This value indicates the willingness to take living streets.

This is a range of values between 0 and 1:

  • Values near 0 attempt to avoid living streets and
  • values near 1 will favor living streets.

Note: sometimes living streets are required to complete a route so values of 0 are not guaranteed to avoid living streets entirely.

Default:

  • truck: 0
  • cars/buses/motor scooters/motorcycles: 0.1
Source

pub fn use_tracks(self, use_tracks: f32) -> Self

This value indicates the willingness to take track roads.

This is a range of values between 0 and 1:

  • Values near 0 attempt to avoid tracks and
  • values near 1 will favor tracks a little bit.

Note: sometimes tracks are required to complete a route so values of 0 are not guaranteed to avoid tracks entirely.

Default:

  • 0 for autos,
  • 0.5 for motor scooters and motorcycles.
Source

pub fn service_penalty(self, service_penalty: f32) -> Self

A penalty applied for transition to generic service road.

Default:

  • 0 trucks and
  • 15 for cars, buses, motor scooters and motorcycles.
Source

pub fn service_factor(self, service_factor: f32) -> Self

A factor that modifies (multiplies) the cost when generic service roads are encountered.

Default: 1

Source

pub fn country_crossing_cost(self, country_crossing_cost: f32) -> Self

A cost applied when encountering an international border.

This cost is added to the estimated and elapsed times.

Default: 600 seconds

Source

pub fn country_crossing_penalty(self, country_crossing_penalty: f32) -> Self

A penalty applied for a country crossing.

This penalty can be used to create paths that avoid spanning country boundaries.

Default: 0

Source

pub fn only_consider_quasi_shortest(self) -> Self

Changes the metric to quasi-shortest, i.e. purely distance-based costing.

Disables ALL other costings & penalties. Also note, shortest will not disable hierarchy pruning, leading to potentially sub-optimal routes for some costing models.

Default: false

Source

pub fn use_distance(self, use_distance: f32) -> Self

A factor that allows controlling the contribution of distance and time to the route costs.

The value is in range between 0 and 1, where

  • 0 only takes time into account (default),
  • 0.5 will weight them roughly equally
  • 1 only distance.

Note: this costing is currently only available for super::Costing::Auto.

Source

pub fn disable_hierarchy_pruning(self) -> Self

Disable hierarchies to calculate the actual optimal route.

Note: This could be quite a performance drainer so there is an upper limit of distance. If the upper limit is exceeded, this option will always be false.

Default: false

Source

pub fn top_speed(self, top_speed: f32) -> Self

Top speed the vehicle can go.

Also used to avoid roads with higher speeds than this value. Must be between 10 and 252 KPH.

Default:

  • truck: 120 KPH
  • auto/bus: 140 KPH
Source

pub fn fixed_speed(self, fixed_speed: u32) -> Self

Fixed speed the vehicle can go. Used to override the calculated speed.

Can be useful if speed of vehicle is known. Must be between 1 and 252 KPH.

Default: 0KPH which disables fixed speed and falls back to the standard calculated speed based on the road attribution.

Source

pub fn closure_factor(self, closure_factor: f32) -> Self

A factor that penalizes the cost when traversing a closed edge

Example: If search_filter.exclude_closures is false for origin and/or destination location and the route starts/ends on closed edges.

Its value can range from

  • 1.0 don’t penalize closed edges,
  • to 10.0 apply high cost penalty to closed edges.

Note: This factor is applicable only for motorized modes of transport, i.e auto, motorcycle, motor_scooter, bus, truck & taxi.

Default: 9.0

Source

pub fn ignore_closures(self) -> Self

If set ignores all closures, marked due to live traffic closures, during routing.

Note: This option cannot be set if location.search_filter.exclude_closures is also specified in the request and will return an error if it is

Source

pub fn ignore_restrictions(self) -> Self

If set, ignores any restrictions (e.g. turn/dimensional/conditional restrictions).

Especially useful for matching GPS traces to the road network regardless of restrictions.

Default: false

Source

pub fn ignore_oneways(self) -> Self

If set, ignores one-way restrictions.

Especially useful for matching GPS traces to the road network ignoring uni-directional traffic rules. Not included in Self::ignore_restrictions option.

Default: false

Source

pub fn ignore_non_vehicular_restrictions(self) -> Self

Similar to Self::ignore_restrictions, but will respect restrictions that impact vehicle safety, such as weight and size restrictions.

Default: false

Source

pub fn ignore_access(self) -> Self

Ignore mode-specific access tags.

Especially useful for matching GPS traces to the road network regardless of restrictions.

Default false

Source

pub fn speed_types(self, speed_types: UsedSpeedSources) -> Self

Will determine which speed sources are used, if available.

A list of strings with the following possible values:

Default: UsedSpeedSources::All sources (again, only if available)

Source

pub fn height(self, height: f32) -> Self

The height of the vehicle (in meters).

Default:

  • car/bus/taxi: 1.9 and
  • truck: 4.11
Source

pub fn width(self, width: f32) -> Self

The width of the vehicle (in meters).

Default:

  • car/bus/taxi: 1.6 and
  • truck: 2.6
Source

pub fn exclude_unpaved(self) -> Self

Exclude unpaved roads.

If exclude_unpaved is set it is allowed to start and end with unpaved roads, but is not allowed to have them in the middle of the route path, otherwise they are allowed.

Default: false.

Source

pub fn exclude_cash_only_tolls(self, exclude_cash_only_tolls: bool) -> Self

Desire to avoid routes with cash-only tolls.

Default: false.

Source

pub fn include_hov2(self, include_hov2: bool) -> Self

Include HOV roads with a 2-occupant requirement in the route when advantageous.

Default: false.

Source

pub fn include_hov3(self, include_hov3: bool) -> Self

Include HOV roads with a 3-occupant requirement in the route when advantageous.

Default: false.

Source

pub fn include_hot(self, include_hot: bool) -> Self

Include tolled HOV roads which require the driver to pay a toll if the occupant requirement isn’t met.

Default: false.

Trait Implementations§

Source§

impl Clone for AutoCostingOptions

Source§

fn clone(&self) -> AutoCostingOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AutoCostingOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AutoCostingOptions

Source§

fn default() -> AutoCostingOptions

Returns the “default value” for a type. Read more
Source§

impl PartialEq for AutoCostingOptions

Source§

fn eq(&self, other: &AutoCostingOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AutoCostingOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AutoCostingOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more