Shouldn't the distance be the same with and without toll costs? - here-api

Here's one (long) example route from Germany to Spain:
https://fleet.api.here.com/2/calculateroute.json?
jsonAttributes=41
&waypoint0=53.94499,10.85676
&waypoint1=41.59747,-4.72606
&currency=EUR
&mode=fastest;truck;traffic:disabled
&legAttributes=none
&trailerType=2
&trailersCount=1
&vehicleNumberAxles=3
&trailerNumberAxles=2
&tiresCount=10
&hybrid=0
&emissionType=6
&fuelType=diesel
&height=400cm
&trailerHeight=400cm
&length=1650cm
&width=255cm
&heightAbove1stAxle=100cm
&vehicleWeight=12000kg
&limitedWeight=40000kg
&commercial=1
&driver_cost=1000
&vehicle_cost=1
&app_id=
&app_code=
The total distance returned is 2121km.
When adding the tollVehicleType=3 parameter to make it calculate the toll costs, the total distance goes up by 113km to 2234km.
To disable toll cost optimization, the driver_cost is set to a high value and the vehicle_cost is set to a low value. This according to the documentation found here:
calculation-considerations.html
To only compute the toll cost along the fastest route (i.e. do not change the route to reduce toll cost)
specify a high value in the driver_cost parameter and a low value in the vehicle_cost parameter.
But it doesn't seem to help, shouldn't the route distance be the same when calculating the route both with and without toll costs?

Got an answer from Here support which did the trick:
Kindly pass the parameter tollPass=transponder as well when
calculating route with toll cost, this would enable the routing
algorithm to consider routes which pass through a roads which, in HERE
data, are marked as "transponder-only". If this parameter is not
passed, the routing engine when using the toll calculation mode avoids
going through roads which are "transponder-only" adding to the
additional distance in the shared case.

Related

What is the use case of the SPEED_LIMITS_VAR layer in the PDE?

I am using the https://m.fleet.ls.hereapi.com/2/calculateroute.json method to match a GPX trace and get the speed limit data for LINK_IDs throughout the route.
The documents for the PDE layers state:
Please be aware that 3-4 different layers need to be evaluated to determine the actual link speed limit: SPEED_LIMITS_FCx (general speed limits), SPEED_LIMITS_VAR_FCx (variable speed limits), SPEED_LIMITS_COND_FCx (conditional speed limits), and TRUCK_SPEED_LIMITS_FCx (in case of a vehicle is a truck). The lowest speed limit on a link is the legal one.
I ideally want to know how the speed limit varies on roads with variable speed signs/smart motorways where the traffic determines the speed.
The information I receive from the layer is:
{
"CONDITION_ID": "743194725",
"LINK_ID": "811864174",
"VSS_ID": "100384",
"DIRECTION": "2",
}
As it doesn't provide a speed limit value, how would I use this information, and is it of any use for what I need to achieve?
The use case of SPEED_LIMITS_VAR layer is to recognize that on some road link a speed limit could be volatility time by time and it means that you can get reality speed limit only by currently traffic info. You know, the SPEED_LIMITS_VAR layer also gives some information about DIRECTION, VARIABLE_SPEED_SIGN_LOCATION, TIME_OVERRIDE, VEHICLE_TYPES, DATE_TIMES.
To get traffic info you can utilize TRAFFIC_SPEED_RECORD_FCn layer, currently you can send the request to API like this: https://pde.api.here.com/2/calculateroute.json?mode=car&departure=2020-11-23T13:54:14&attributes=SPEED_LIMITS_FCn(*),TRAFFIC_SPEED_RECORD_FCn(*)&app_id=---&app_code=---&routeMatch=1 but unfortunately, currently, you have to use only domain name "pde.api.here.com" in request and use for it only app_id, app_code parameters. For domain names like https://s.fleet.ls.hereapi.com and apiKey credentials the layer TRAFFIC_SPEED_RECORD_FCn (as 'attributes' parameter) will be available later.
The description of layer TRAFFIC_SPEED_RECORD_FCn you can read on https://tcs.ext.here.com/pde/layer?region=TSRWORLD&release=&url_root=pde.api.here.com&layer=TRAFFIC_SPEED_RECORD_FC1
If you don't have app_id, app_code but have apiKey then to get info from layer TRAFFIC_SPEED_RECORD_FC you need to send second request using https://s.fleet.ls.hereapi.com and Corridor search or Tiles search

Matrix routing with destinations close to motorways

I have a number of locations between which I want to know the travel time and distance.
The locations have been correctly geocoded. However, the problem I am experiencing is that some of the locations lie between a regular road and a motorway. In fact, they lie closest to the motorway.
In this case, the travel time and distance I receive consider the location to lie on the motorway (the closest road), which leads to an incorrect estimation of the actual travel time and distance.
Given that I cannot manually adapt each geocode to lie closest to the regular road, I need a different solution.
I included 'street!!' in my call as indicated on https://developer.here.com/api-explorer/rest/routing/route-to-location-near-motorway but to no avail.
My call looks like this "https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=x.x,y.y&destination0=street!!x1.x1,y1.y1&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=...".
Is there another way to avoid that Here puts the destination on the motorway?
Your help would be greatly appreciated. Thank you in advance!
Below you find one example
Geocodes of departure: 51.090995,4.018793
Geocodes of destination: 51.017960,3.694040 (close to E40/A10 in Belgium)
When I use the matrix routing API, I get a distance of 29799 meters and a travel time of 1317 seconds.
My call:
"https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=51.090995,4.018793&destination0=street!!51.017960,3.694040&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=..."
When I use the routing API to get the directions, I can see that my destination is updated to 51.0187054,3.6935735, which is on the E40/A10. This gives me a distance of 29827 meters and a travel time of 1335 seconds.
I used the call below:
"https://route.api.here.com/routing/7.2/calculateroute.json?app_id=...&app_code=...&waypoint0=51.090995,4.018793&waypoint1=street!!51.017960,3.694040&mode=fastest;car;traffic:disabled"
Given that the distance and travel time differs, I executed my matrix routing API call again with the updated destination geocodes (51.0187054,3.6935735). This provided me with the same distance and travel time as my initial matrix routing request, i.e. 29799 meters and 1317 seconds.
I used this call:
"https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=51.090995,4.018793&destination0=street!!51.0187054,3.6935735&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=..."
As such, I am sure the destination is on the E40/A10. How can I avoid this?
On a related note, why do the travel time and distance differ between the matrix routing API and the routing API?
When I enter the geocodes in GoogleMaps, I actually get the position I wanted.
As you can see, it is not on the E40. Why can't I get a route to the nearest regular street?
So taking the example you gave, the destination waypoint 51.017960,3.694040 lies very close if not on the E40/A10 itself. See image below:
Moreover, using our reverse geocoder API to get the list of address within 200m radius of the destination waypoint returns only addresses (points) along the E40, 9052 Gent, België with street match level . There is therefore no way for the algorithm to know which nearby street you intend to arrive when the waypoint is many hundreds of metres off. I will suggest to correct your waypoints using our reverse geocoder api to determine which waypoints are way off your intended address.

HERE Isoline Traffic:Disabled - How are routes calulcated

I'm experimenting with the Isoline API and have a question about the effects of two parameters:
Mode: Shortest
The docs imply that things like turns are penalized. By what factor? Known travel times, or some arbitrary estimation?
Traffic: Disabled
The docs imply that traffic is not taken into account. Does this mean the cost of traversing a component of a road is a function of the speed limit, or collected data on actual travel speeds on that route?
Thanks in advance.
For your questions:
Turns are penalization depend on multiple factors which are different for turns of different characteristic (road types, turn geometry etc).
This takes the actual travel speeds into account.

metricSystem parameter support in "discover/search"

distance is given in meters for this query:
https://places.cit.api.here.com/places/v1/discover/search?app_id=my-app-id&app_code=my-app-code&at=36.97425,-122.03099&pretty
Is there any plan to support "metricSystem" parameter(as is done in the case of Routing APIs) so that the result can provide distance in miles?
Correct, the distances are just given back in meters from the Places API. There are no further plans to change this in future. But you can easily calculate the values into miles on client side.

Can I pass multiple travel modes when using The Google Maps Distance Matrix API

I need to calculating times and distances with multple travel modes, I try to pass multiple travel modes separated with | like this:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=E149AQ&destinations=UB83PH|NW14SA|WC1E7HU|N78DB&mode=walking|bicycling|driving&language=en-GB&key=myKey
But it doesn't work as I expected.
Only a single travel mode is supported per request. To get results for multiple travel modes, make multiple requests.
The documentation implies that but doesn't state it explicitly:
Optional parameters
mode (defaults to driving) — Specifies the mode of transport to use when calculating distance. Valid values and other request details are specified in the Travel Modes section of this document.
Travel Modes
For the calculation of distances, you may specify the transportation mode to use. By default, distances are calculated for driving directions. The following travel modes are supported:
driving (default) indicates distance calculation using the road network.
walking requests distance calculation for walking via pedestrian paths & sidewalks (where available).
bicycling requests distance calculation for bicycling via bicycle paths & preferred streets (where available).
transit requests distance calculation via public transit routes (where available). This value may only be specified if the request includes an API key or a Google Maps API for Work client ID. If you set the mode to transit you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.
Note: Both walking and bicycling directions may sometimes not include clear pedestrian or bicycling paths, so these directions will return warnings in the returned result which you must display to the user.

Resources