here_location_services.matrix_routing_api module
This module contains classes for accessing HERE Matrix Routing API.
- class here_location_services.matrix_routing_api.MatrixRoutingApi(api_key=None, auth=None, proxies=None, country='row')[source]
Bases:
here_location_services.apis.Api
A class to access Matrix Routing API.
- Parameters
api_key (Optional[str]) –
auth (Optional[here_location_services.platform.auth.Auth]) –
proxies (Optional[dict]) –
country (str) –
- __init__(api_key=None, auth=None, proxies=None, country='row')[source]
- Parameters
api_key (Optional[str]) –
auth (Optional[here_location_services.platform.auth.Auth]) –
proxies (Optional[dict]) –
country (str) –
- __send_post_request(async_req, origins, region_definition, destinations=None, profile=None, departure_time=None, routing_mode=None, transport_mode=None, avoid_features=None, avoid_areas=None, truck=None, matrix_attributes=None)
- Parameters
async_req (str) –
origins (List[Dict]) –
region_definition (Union[here_location_services.config.matrix_routing_config.CircleRegion, here_location_services.config.matrix_routing_config.BoundingBoxRegion, here_location_services.config.matrix_routing_config.PolygonRegion, here_location_services.config.matrix_routing_config.AutoCircleRegion, here_location_services.config.matrix_routing_config.WorldRegion]) –
destinations (Optional[List[Dict]]) –
profile (Optional[str]) –
departure_time (Optional[Union[datetime.datetime, str]]) –
routing_mode (Optional[str]) –
transport_mode (Optional[str]) –
avoid_features (Optional[List[str]]) –
avoid_areas (Optional[List[here_location_services.config.matrix_routing_config.AvoidBoundingBox]]) –
truck (Optional[here_location_services.config.base_config.Truck]) –
matrix_attributes (Optional[List[str]]) –
- Return type
Dict
- matrix_route(origins, region_definition, destinations=None, profile=None, departure_time=None, routing_mode=None, transport_mode=None, avoid_features=None, avoid_areas=None, truck=None, matrix_attributes=None)[source]
To Calculate routing matrix between multiple
origins
anddestinations
synchronously.- Parameters
origins (List[Dict]) – A list of dictionaries containing lat and long for origin points.
region_definition (Union[here_location_services.config.matrix_routing_config.CircleRegion, here_location_services.config.matrix_routing_config.BoundingBoxRegion, here_location_services.config.matrix_routing_config.PolygonRegion, here_location_services.config.matrix_routing_config.AutoCircleRegion, here_location_services.config.matrix_routing_config.WorldRegion]) – Definition of a region in which the matrix will be calculated. Use object of atleast one of the following regions:
here_location_services.config.matrix_routing_config.CircleRegion
here_location_services.config.matrix_routing_config.BoundingBoxRegion
here_location_services.config.matrix_routing_config.PolygonRegion
here_location_services.config.matrix_routing_config.AutoCircleRegion
here_location_services.config.matrix_routing_config.WorldRegion
destinations (Optional[List[Dict]]) – A list of dictionaries containing lat and long for destination points. When no destinations are specified the matrix is assumed to be quadratic with origins used as destinations.
profile (Optional[str]) – A string to represent profile id. A set predefined profile ids for route calculation can be used from config
PROFILE
departure_time (Optional[Union[datetime.datetime, str]]) –
datetime.datetime
object.routing_mode (Optional[str]) – A string to represent routing mode. Routing mode values are defined in
ROUTING_MODE
transport_mode (Optional[str]) – A string to represent transport mode. Transport modes are defined in
ROUTING_TRANSPORT_MODE
avoid_features (Optional[List[str]]) – Avoid routes that violate these properties. Avoid features are defined in
AVOID_FEATURES
avoid_areas (Optional[List[here_location_services.config.matrix_routing_config.AvoidBoundingBox]]) – A list of areas to avoid during route calculation. To define avoid area use object of
AvoidBoundingBox here_location_services.config.matrix_routing_config.AvoidBoundingBox>
truck (Optional[here_location_services.config.base_config.Truck]) – Different truck options to use during route calculation when transportMode = truck. use object of
Truck here_location_services.config.base_config.Truck>
matrix_attributes (Optional[List[str]]) – Defines which attributes are included in the response as part of the data representation of the matrix entries summaries. Matrix attributes are defined in
MATRIX_ATTRIBUTES
- Returns
requests.Response
object.- Return type
Dict
- matrix_route_async(origins, region_definition, destinations=None, profile=None, departure_time=None, routing_mode=None, transport_mode=None, avoid_features=None, avoid_areas=None, truck=None, matrix_attributes=None)[source]
To Calculate routing matrix between multiple
origins
anddestinations
asynchronously.- Parameters
origins (List[Dict]) – A list of dictionaries containing lat and long for origin points.
region_definition (Union[here_location_services.config.matrix_routing_config.CircleRegion, here_location_services.config.matrix_routing_config.BoundingBoxRegion, here_location_services.config.matrix_routing_config.PolygonRegion, here_location_services.config.matrix_routing_config.AutoCircleRegion, here_location_services.config.matrix_routing_config.WorldRegion]) – Definition of a region in which the matrix will be calculated. Use object of atleast one of the following regions:
here_location_services.config.matrix_routing_config.CircleRegion
here_location_services.config.matrix_routing_config.BoundingBoxRegion
here_location_services.config.matrix_routing_config.PolygonRegion
here_location_services.config.matrix_routing_config.AutoCircleRegion
here_location_services.config.matrix_routing_config.WorldRegion
destinations (Optional[List[Dict]]) – A list of dictionaries containing lat and long for destination points. When no destinations are specified the matrix is assumed to be quadratic with origins used as destinations.
profile (Optional[str]) – A string to represent profile id. A set predefined profile ids for route calculation can be used from config
PROFILE
departure_time (Optional[Union[datetime.datetime, str]]) –
datetime.datetime
object.routing_mode (Optional[str]) – A string to represent routing mode. Routing mode values are defined in
ROUTING_MODE
transport_mode (Optional[str]) – A string to represent transport mode. Transport modes are defined in
ROUTING_TRANSPORT_MODE
avoid_features (Optional[List[str]]) – Avoid routes that violate these properties. Avoid features are defined in
AVOID_FEATURES
avoid_areas (Optional[List[here_location_services.config.matrix_routing_config.AvoidBoundingBox]]) – A list of areas to avoid during route calculation. To define avoid area use object of
AvoidBoundingBox here_location_services.config.matrix_routing_config.AvoidBoundingBox>
truck (Optional[here_location_services.config.base_config.Truck]) – Different truck options to use during route calculation when transportMode = truck. use object of
Truck here_location_services.config.matrix_routing_config.Truck>
matrix_attributes (Optional[List[str]]) – Defines which attributes are included in the response as part of the data representation of the matrix entries summaries. Matrix attributes are defined in
MATRIX_ATTRIBUTES
- Returns
requests.Response
object.- Return type
Dict