PySide6.QtLocation.QGeoRoute

class QGeoRoute

The QGeoRoute class represents a route between two points. More

Synopsis

Properties

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

A QGeoRoute object contains high level information about a route, such as the length the route, the estimated travel time for the route, and enough information to render a basic image of the route on a map.

The QGeoRoute object also contains a list of QGeoRouteSegment objecs which describe subsections of the route in greater detail.

Routing information is normally requested using calculateRoute() , which returns a QGeoRouteReply instance. If the operation is completed successfully the routing information can be accessed with routes()

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property boundsᅟ: QGeoRectangle

This property holds the bounding box which encompasses the entire route.

Access functions:
property distanceᅟ: float

This property holds the distance covered by this route, in meters.

Access functions:
property extendedAttributesᅟ: Dictionary with keys of type .QString and values of type QVariant.

This property holds the extended attributes associated with this route.

Access functions:
property legIndexᅟ: int

This property holds the leg index of this route.

The index of the leg inside the containing routeLegs list can be used to find the next legs.

Access functions:
property overallRouteᅟ: QGeoRoute

This property holds the route that contains this route leg.

This this route is not a leg within an overall route, then this property holds an empty route.

Access functions:
property pathᅟ: list of QGeoCoordinate

This property holds the geometric shape of the route.

The coordinates should be listed in the order in which they would be traversed by someone traveling along this segment of the route.

Access functions:
property routeIdᅟ: str

This property holds the identifier of this route.

Service providers which support the updating of routes commonly assign identifiers to routes. If this route came from such a service provider, then changing the identifier will probably cause route updates to stop working.

Access functions:
property routeLegsᅟ: list of QGeoRoute

This property holds the route legs for a multi-waypoint route.

Access functions:
property segmentsᅟ: list of QGeoRouteSegment

This property holds the list of QGeoRouteSegment objects of this route.

Access functions:
property segmentsCountᅟ: int

This property holds the number of segments in the route.

Access functions:
property travelTimeᅟ: int

This property holds the estimated amount of time it will take to traverse this route, in seconds.

Access functions:
__init__()

Constructs a route object.

__init__(other)
Parameters:

otherQGeoRoute

Constructs a route object from the contents of other.

bounds()
Return type:

QGeoRectangle

Getter of property boundsᅟ .

distance()
Return type:

float

Getter of property distanceᅟ .

extendedAttributes()
Return type:

Dictionary with keys of type .QString and values of type QVariant.

Getter of property extendedAttributesᅟ .

firstRouteSegment()
Return type:

QGeoRouteSegment

Returns the first route segment in the route.

Will return an invalid route segment if there are no route segments associated with the route.

The remaining route segments can be accessed sequentially with nextRouteSegment .

legIndex()
Return type:

int

Getter of property legIndexᅟ .

__ne__(rhs)
Parameters:

rhsQGeoRoute

Return type:

bool

Returns whether the routes lhs and rhs are not equal.

__eq__(rhs)
Parameters:

rhsQGeoRoute

Return type:

bool

Returns whether the routes lhs and rhs are equal.

overallRoute()
Return type:

QGeoRoute

Getter of property overallRouteᅟ .

path()
Return type:

.list of QGeoCoordinate

See also

setPath()

Getter of property pathᅟ .

request()
Return type:

QGeoRouteRequest

routeId()
Return type:

str

Getter of property routeIdᅟ .

routeLegs()
Return type:

.list of QGeoRoute

Getter of property routeLegsᅟ .

segments()
Return type:

.list of QGeoRouteSegment

Getter of property segmentsᅟ .

segmentsCount()
Return type:

int

Getter of property segmentsCountᅟ .

setBounds(bounds)
Parameters:

boundsQGeoRectangle

setDistance(distance)
Parameters:

distance – float

setExtendedAttributes(extendedAttributes)
Parameters:

extendedAttributes – Dictionary with keys of type .QString and values of type QVariant.

setFirstRouteSegment(routeSegment)
Parameters:

routeSegmentQGeoRouteSegment

Sets the first route segment in the route to routeSegment.

setLegIndex(idx)
Parameters:

idx – int

setOverallRoute(route)
Parameters:

routeQGeoRoute

setPath(path)
Parameters:

path – .list of QGeoCoordinate

See also

path()

Setter of property pathᅟ .

setRequest(request)
Parameters:

requestQGeoRouteRequest

setRouteId(id)
Parameters:

id – str

setRouteLegs(legs)
Parameters:

legs – .list of QGeoRoute

setTravelMode(mode)
Parameters:

modeTravelMode

Sets the travel mode for this route to mode.

This should be one of the travel modes returned by request().travelModes().

See also

travelMode()

setTravelTime(secs)
Parameters:

secs – int

swap(other)
Parameters:

otherQGeoRoute

travelMode()
Return type:

TravelMode

Returns the travel mode for the this route.

This should be one of the travel modes returned by request().travelModes().

See also

setTravelMode()

travelTime()
Return type:

int

Getter of property travelTimeᅟ .