class QGeoRouteRequest

The QGeoRouteRequest class represents the parameters and restrictions which define a request for routing information. More

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

The default state of a QGeoRouteRequest instance will result in a request for basic route segment and navigation maneuvers describing the fastest route by car which covers the given waypoints.

There may be significant variation in the features supported by different providers of routing information, or even in the features supported by the same provider if different levels of authorization are used.

There are several functions in QGeoRoutingManager which can be used to check which features are supported with the current provider and authorization level.

class TravelMode

(inherits enum.Flag) Defines modes of travel to be used for a route.

Constant

Description

QGeoRouteRequest.CarTravel

The route will be optimized for someone who is driving a car.

QGeoRouteRequest.PedestrianTravel

The route will be optimized for someone who is walking.

QGeoRouteRequest.BicycleTravel

The route will be optimized for someone who is riding a bicycle.

QGeoRouteRequest.PublicTransitTravel

The route will be optimized for someone who is making use of public transit.

QGeoRouteRequest.TruckTravel

The route will be optimized for someone who is driving a truck.

class FeatureType

(inherits enum.Flag) Defines a feature which is important to the planning of a route.

These values will be used in combination with FeatureWeight to determine if they should or should not be part of the route.

Constant

Description

QGeoRouteRequest.NoFeature

Used by supportedFeatureTypes() to indicate that no features will be taken into account when planning the route.

QGeoRouteRequest.TollFeature

Consdier tollways when planning the route.

QGeoRouteRequest.HighwayFeature

Consider highways when planning the route.

QGeoRouteRequest.PublicTransitFeature

Consider public transit when planning the route.

QGeoRouteRequest.FerryFeature

Consider ferries when planning the route.

QGeoRouteRequest.TunnelFeature

Consider tunnels when planning the route.

QGeoRouteRequest.DirtRoadFeature

Consider dirt roads when planning the route.

QGeoRouteRequest.ParksFeature

Consider parks when planning the route.

QGeoRouteRequest.MotorPoolLaneFeature

Consider motor pool lanes when planning the route.

QGeoRouteRequest.TrafficFeature

Consider the current traffic situation when planning the route. Since QtLocation 5.10

class FeatureWeight

(inherits enum.Flag) Defines the weight to associate with a feature during the planning of a route.

These values will be used in combination with QGeoRouteRequest::Feature to determine if they should or should not be part of the route.

Constant

Description

QGeoRouteRequest.NeutralFeatureWeight

The presence or absence of the feature will not affect the planning of the route.

QGeoRouteRequest.PreferFeatureWeight

Routes which contain the feature will be preferred over those that do not.

QGeoRouteRequest.RequireFeatureWeight

Only routes which contain the feature will be considered, otherwise no route will be returned.

QGeoRouteRequest.AvoidFeatureWeight

Routes which do not contain the feature will be preferred over those that do.

QGeoRouteRequest.DisallowFeatureWeight

Only routes which do not contain the feature will be considered, otherwise no route will be returned.

class RouteOptimization

(inherits enum.Flag) Defines the type of optimization which is applied to the planning of the route.

Constant

Description

QGeoRouteRequest.ShortestRoute

Minimize the length of the journey.

QGeoRouteRequest.FastestRoute

Minimize the traveling time for the journey.

QGeoRouteRequest.MostEconomicRoute

Minimize the cost of the journey.

QGeoRouteRequest.MostScenicRoute

Maximize the scenic potential of the journey.

class SegmentDetail

(inherits enum.Flag) Defines the amount of route segment information that should be included with the route.

Constant

Description

QGeoRouteRequest.NoSegmentData

No segment data should be included with the route. A route requested with this level of segment detail will initialize path() as a straight line between the positions of the previous and next QGeoManeuver instances.

QGeoRouteRequest.BasicSegmentData

Basic segment data will be included with the route. This will include path() .

class ManeuverDetail

(inherits enum.Flag) Defines the amount of maneuver information that should be included with the route.

Constant

Description

QGeoRouteRequest.NoManeuvers

No maneuvers should be included with the route.

QGeoRouteRequest.BasicManeuvers

Basic manevuers will be included with the route. This will include instructionText() .

__init__(other)
Parameters:

otherQGeoRouteRequest

Constructs a route request object from the contents of other.

__init__([waypoints=list()])
Parameters:

waypoints – .list of QGeoCoordinate

Constructs a request to calculate a route through the coordinates waypoints.

The route will traverse the objects of waypoints in order.

__init__(origin, destination)
Parameters:

Constructs a request to calculate a route between origin and destination.

departureTime()
Return type:

QDateTime

Returns the departure time in the request.

excludeAreas()
Return type:

.list of QGeoRectangle

Returns areas the route must not cross.

featureTypes()
Return type:

.list of QGeoRouteRequest.FeatureType

Returns the list of features that will be considered when planning the route. Features with a weight of NeutralFeatureWeight will not be returned.

featureWeight(featureType)
Parameters:

featureTypeFeatureType

Return type:

FeatureWeight

Returns the weight assigned to featureType in the planning of the route.

If no feature weight has been specified for featureType then NeutralFeatureWeight will be returned.

maneuverDetail()
Return type:

ManeuverDetail

Returns the level of detail which will be used in the representation of routing maneuvers.

numberAlternativeRoutes()
Return type:

int

Returns the number of alternative routes which will be requested.

__ne__(rhs)
Parameters:

rhsQGeoRouteRequest

Return type:

bool

Returns whether the route requests lhs and rhs are not equal.

__eq__(rhs)
Parameters:

rhsQGeoRouteRequest

Return type:

bool

Returns whether the route requests lhs and rhs are equal.

routeOptimization()
Return type:

Combination of RouteOptimization

Returns the optimization criteria which this request specifies should be used while planning the route.

segmentDetail()
Return type:

SegmentDetail

Returns the level of detail which will be used in the representation of routing segments.

setDepartureTime(departureTime)
Parameters:

departureTimeQDateTime

Sets the departure time departureTime for the route calculation. This information can be used by the backend to calculate a faster route, for example, by avoiding traffic congestion during rush hour.

The default value is an invalid QDateTime.

See also

departureTime()

setExcludeAreas(areas)
Parameters:

areas – .list of QGeoRectangle

Sets areas as excluded areas that the route must not cross.

See also

excludeAreas()

setFeatureWeight(featureType, featureWeight)
Parameters:

Assigns the weight featureWeight to the feature featureType during the planning of the route.

By default all features are assigned a weight of NeutralFeatureWeight .

It is impossible to assign a weight to NoFeature .

See also

featureWeight()

setManeuverDetail(maneuverDetail)
Parameters:

maneuverDetailManeuverDetail

Sets the level of detail to use when representing routing maneuvers to maneuverDetail.

The default value is BasicManeuvers .

See also

maneuverDetail()

setNumberAlternativeRoutes(alternatives)
Parameters:

alternatives – int

Sets the number of alternative routes to request to alternatives. If alternatives is negative the number of alternative routes is set to 0.

The default value is 0.

setRouteOptimization(optimization)
Parameters:

optimization – Combination of RouteOptimization

Sets the optimization criteria to use while planning the route to optimization.

The default value is FastestRoute .

setSegmentDetail(segmentDetail)
Parameters:

segmentDetailSegmentDetail

Sets the level of detail to use when representing routing segments to segmentDetail.

See also

segmentDetail()

setTravelModes(travelModes)
Parameters:

travelModes – Combination of TravelMode

Sets the travel modes which should be considered during the planning of the route to travelModes.

The default value is CarTravel .

See also

travelModes()

setWaypoints(waypoints)
Parameters:

waypoints – .list of QGeoCoordinate

Sets waypoints as the waypoints that the route should pass through.

The waypoints should be given in order from origin to destination.

This request will be invalid until the waypoints have been set to a list containing two or more coordinates.

See also

waypoints()

swap(other)
Parameters:

otherQGeoRouteRequest

travelModes()
Return type:

Combination of TravelMode

Returns the travel modes which this request specifies should be considered during the planning of the route.

See also

setTravelModes()

waypoints()
Return type:

.list of QGeoCoordinate

Returns the waypoints that the route will pass through.

See also

setWaypoints()